MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / jobqueue_push

Function jobqueue_push

src/util/thpool/thpool.c:493–512  ·  view source on GitHub ↗

Add (allocated) job to queue */

Source from the content-addressed store, hash-verified

491
492/* Add (allocated) job to queue */
493static void jobqueue_push(jobqueue *jobqueue_p, struct job *newjob) {
494 newjob->prev = NULL;
495
496 pthread_mutex_lock(&jobqueue_p->rwmutex);
497
498 switch(jobqueue_p->len) {
499 case 0: /* no jobs in queue */
500 jobqueue_p->front = newjob;
501 jobqueue_p->rear = newjob;
502 break;
503 default: /* jobs in queue */
504 jobqueue_p->rear->prev = newjob;
505 jobqueue_p->rear = newjob;
506 }
507
508 jobqueue_p->len++;
509 bsem_post(jobqueue_p->has_jobs);
510
511 pthread_mutex_unlock(&jobqueue_p->rwmutex);
512}
513
514/* Get first job from queue(removes it from queue)
515 *

Callers 1

thpool_add_workFunction · 0.85

Calls 1

bsem_postFunction · 0.85

Tested by

no test coverage detected