/* allocates the job */
job = free_jobs;
- if (!job) {
+ if (job)
+ free_jobs = job->next;
+ else {
pthread_mutex_unlock(&mutex);
job = malloc(sizeof *job);
pthread_mutex_lock(&mutex);
}
/* terminate all the threads and all pending requests */
-void jobs_terminate()
+void jobs_terminate(int wait)
{
struct job *job;
pthread_t me, other;