server/thpool.c
/* Add (allocated) job to queue
 */
Add (allocated) job to queue
Add ( allocated ) job to queue
static void jobqueue_push(jobqueue *jobqueue_p, struct job *newjob) {
    pthread_mutex_lock(&jobqueue_p->rwmutex);
    newjob->prev = NULL;
    switch (jobqueue_p->len) {
        case 0:  
            jobqueue_p->front = newjob;
            jobqueue_p->rear = newjob;
            break;
        default: 
            jobqueue_p->rear->prev = newjob;
            jobqueue_p->rear = newjob;
    }
    jobqueue_p->len++;
    bsem_post(jobqueue_p->has_jobs);
    pthread_mutex_unlock(&jobqueue_p->rwmutex);
}
static void jobqueue_push ( jobqueue * jobqueue_p , struct job * newjob ) { pthread_mutex_lock ( & jobqueue_p -> rwmutex ) ; newjob -> prev = NULL ; switch ( jobqueue_p -> len ) { case 0 : jobqueue_p -> front = newjob ; jobqueue_p -> rear = newjob ; break ; default : jobqueue_p -> rear -> prev = newjob ; jobqueue_p -> rear = newjob ; } jobqueue_p -> len ++ ; bsem_post ( jobqueue_p -> has_jobs ) ; pthread_mutex_unlock ( & jobqueue_p -> rwmutex ) ; }
Add (allocated) job to queue
Add ( allocated ) job to queue
/* if no jobs in queue */ /* if jobs in queue */