server/thpool.c
/* Add work to the thread pool */
Add work to the thread pool
Add work to the thread pool
int thpool_add_work(thpool_ *thpool_p, void (*function_p)(void *), void *arg_p) {
    job *newjob;
    newjob = (struct job *) malloc(sizeof(struct job));
    if (newjob == NULL) {
        err("thpool_add_work(): Could not allocate memory for new job\n");
        return -1;
    }
    newjob->function = function_p;
    newjob->arg = arg_p;
    jobqueue_push(&thpool_p->jobqueue, newjob);
    return 0;
}
int thpool_add_work ( thpool_ * thpool_p , void ( * function_p ) ( void * ) , void * arg_p ) { job * newjob ; newjob = ( struct job * ) malloc ( sizeof ( struct job ) ) ; if ( newjob == NULL ) { err ( " \n " ) ; return -1 ; } newjob -> function = function_p ; newjob -> arg = arg_p ; jobqueue_push ( & thpool_p -> jobqueue , newjob ) ; return 0 ; }
Add work to the thread pool
Add work to the thread pool
/* add function and argument */ /* add job to queue */