Source/Backend/thread_pool/gtr_thread_pool.c
static void job_queue_push(job_queue *job_queue_p, job *new_job_p) {

    pthread_mutex_lock(&job_queue_p->rwmutex);
    new_job_p->prev = NULL;

    switch (job_queue_p->length) {

        case 0:  /* if no jobs in queue */
            job_queue_p->front = new_job_p;
            job_queue_p->rear = new_job_p;
            break;

        default: /* if jobs in queue */
            job_queue_p->rear->prev = new_job_p;
            job_queue_p->rear = new_job_p;

    }
    job_queue_p->length++;

    binary_semaphore_post(job_queue_p->has_jobs);
    pthread_mutex_unlock(&job_queue_p->rwmutex);
}
/*
 * Add (allocated) job to queue
 */
Add (allocated) job to queue
Add ( allocated ) job to queue
static void job_queue_push(job_queue *job_queue_p, job *new_job_p) {
    pthread_mutex_lock(&job_queue_p->rwmutex);
    new_job_p->prev = NULL;
    switch (job_queue_p->length) {
        case 0:  
            job_queue_p->front = new_job_p;
            job_queue_p->rear = new_job_p;
            break;
        default: 
            job_queue_p->rear->prev = new_job_p;
            job_queue_p->rear = new_job_p;
    }
    job_queue_p->length++;
    binary_semaphore_post(job_queue_p->has_jobs);
    pthread_mutex_unlock(&job_queue_p->rwmutex);
}
static void job_queue_push ( job_queue * job_queue_p , job * new_job_p ) { pthread_mutex_lock ( & job_queue_p -> rwmutex ) ; new_job_p -> prev = NULL ; switch ( job_queue_p -> length ) { case 0 : job_queue_p -> front = new_job_p ; job_queue_p -> rear = new_job_p ; break ; default : job_queue_p -> rear -> prev = new_job_p ; job_queue_p -> rear = new_job_p ; } job_queue_p -> length ++ ; binary_semaphore_post ( job_queue_p -> has_jobs ) ; pthread_mutex_unlock ( & job_queue_p -> rwmutex ) ; }
Add (allocated) job to queue
Add ( allocated ) job to queue
/* if no jobs in queue */ /* if jobs in queue */