36 #include <ldns/ldns.h> 38 static const char* fifoq_str =
"fifo";
51 ods_log_error(
"[%s] unable to create fifoq: allocator_alloc() failed",
56 lock_basic_init(&fifoq->
q_lock);
88 if (!q || q->
count <= 0) {
92 *worker = q->
owner[0];
93 for (i = 0; i < q->
count-1; i++) {
116 if (!q || !item || !worker) {
117 return ODS_STATUS_ASSERT_ERR;
127 ods_log_debug(
"[%s] queue full, notify drudgers again", fifoq_str);
131 return ODS_STATUS_UNCHANGED;
135 assert(worker->
task);
139 ods_log_deeebug(
"[%s] threshold %lu reached, notify drudgers",
140 fifoq_str, (
unsigned long) q->
count);
144 return ODS_STATUS_OK;
160 lock_basic_destroy(&q->
q_lock);
cond_basic_type q_threshold
ods_status fifoq_push(fifoq_type *q, void *item, worker_type *worker, int *tries)
#define FIFOQ_TRIES_COUNT
void fifoq_cleanup(fifoq_type *q)
void fifoq_wipe(fifoq_type *q)
void * blob[FIFOQ_MAX_COUNT]
worker_type * owner[FIFOQ_MAX_COUNT]
fifoq_type * fifoq_create()
cond_basic_type q_nonfull
void * fifoq_pop(fifoq_type *q, worker_type **worker)