forked from Ocean/datum_gateway
Merge branch '0.2.x'
This commit is contained in:
commit
9b7601362b
@ -572,6 +572,7 @@ int datum_api_cmd(struct MHD_Connection *connection, char *post, int len) {
|
||||
}
|
||||
}
|
||||
}
|
||||
json_decref(root);
|
||||
}
|
||||
} else {
|
||||
root = json_object();
|
||||
|
@ -872,8 +872,13 @@ void *datum_coinbaser_thread(void *ptr) {
|
||||
}
|
||||
|
||||
int datum_coinbaser_init(void) {
|
||||
// TODO: Handle failed (rare, not priority)
|
||||
pthread_t pthread_datum_coinbaser_thread;
|
||||
pthread_create(&pthread_datum_coinbaser_thread, NULL, datum_coinbaser_thread, NULL);
|
||||
int result = pthread_create(&pthread_datum_coinbaser_thread, NULL, datum_coinbaser_thread, NULL);
|
||||
|
||||
if (result != 0) {
|
||||
DLOG_FATAL("datum_coinbaser_init: pthread_create failed with code %d", result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -68,11 +68,10 @@ int datum_queue_free(DATUM_QUEUE *q) {
|
||||
|
||||
q->initialized = false;
|
||||
q->buffer[0] = 0;
|
||||
q->buffer[0] = 0;
|
||||
|
||||
pthread_rwlock_unlock(&q->active_buffer_rwlock);
|
||||
pthread_rwlock_unlock(&q->buffer_rwlock[0]);
|
||||
pthread_rwlock_unlock(&q->buffer_rwlock[1]);
|
||||
pthread_rwlock_unlock(&q->buffer_rwlock[0]);
|
||||
pthread_rwlock_unlock(&q->active_buffer_rwlock);
|
||||
|
||||
pthread_rwlock_destroy(&q->active_buffer_rwlock);
|
||||
pthread_rwlock_destroy(&q->buffer_rwlock[0]);
|
||||
@ -132,7 +131,8 @@ int datum_queue_add_item(DATUM_QUEUE *q, void *item) {
|
||||
// Add the msg to the logger queue
|
||||
// this is probably overkill...
|
||||
for (i=0;i<10000000;i++) {
|
||||
if (i < 99999990) { // ensure we don't get the lock on the last try and forget to unlock and crash
|
||||
if (i < 9999999) { // ensure we don't get the lock on the last try and forget to unlock and crash
|
||||
|
||||
// get the active buffer ID
|
||||
pthread_rwlock_rdlock(&q->active_buffer_rwlock);
|
||||
buffer_id = q->active_buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user