MCPcopy Create free account
hub / github.com/antirez/ds4 / dist_worker_job_queue_pop

Function dist_worker_job_queue_pop

ds4_distributed.c:7693–7710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7691 pthread_cond_broadcast(&q->not_empty);
7692 pthread_cond_broadcast(&q->not_full);
7693 pthread_mutex_unlock(&q->mu);
7694}
7695
7696static bool dist_worker_job_queue_enqueue(
7697 ds4_dist_worker_job_queue *q,
7698 ds4_dist_worker_job *job) {
7699 pthread_mutex_lock(&q->mu);
7700 while (!q->closed && !q->canceled && q->queued >= q->depth) {
7701 pthread_cond_wait(&q->not_full, &q->mu);
7702 }
7703 if (q->closed || q->canceled) {
7704 pthread_mutex_unlock(&q->mu);
7705 return false;
7706 }
7707 if (q->tail) q->tail->next = job;
7708 else q->head = job;
7709 q->tail = job;
7710 q->queued++;
7711 pthread_cond_signal(&q->not_empty);
7712 pthread_mutex_unlock(&q->mu);
7713 return true;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected