#if INSTANT_NOTEMPTY_NOTIFY
empty = que->last == que->first;
#endif
+ que->jobs_added++;
pipe_mutex_unlock( que->que_mutex );
/* Submit new job.
que->jobs[que->last].inout = quad->inout;
que->jobs[que->last].routine = routine;
que->last = (que->last + 1) % NUM_QUAD_JOBS;
- que->jobs_added++;
#if INSTANT_NOTEMPTY_NOTIFY
/* If the que was empty, notify consumers there's a job to be done.
*/
- if (empty)
+ if (empty) {
+ pipe_mutex_lock( que->que_mutex );
pipe_condvar_broadcast( que->que_notempty_condvar );
+ pipe_mutex_unlock( que->que_mutex );
+ }
#endif
}
*/
job = que->jobs[que->first];
que->first = (que->first + 1) % NUM_QUAD_JOBS;
- pipe_mutex_unlock( que->que_mutex );
/* Notify the producer if the que is not full.
*/
if (full)
pipe_condvar_signal( que->que_notfull_condvar );
+ pipe_mutex_unlock( que->que_mutex );
job.routine( info->setup, info->id, &job );
#define WAIT_FOR_COMPLETION(setup) \
do {\
+ pipe_mutex_lock( setup->que.que_mutex );\
if (!INSTANT_NOTEMPTY_NOTIFY)\
pipe_condvar_broadcast( setup->que.que_notempty_condvar );\
- pipe_mutex_lock( setup->que.que_mutex );\
while (setup->que.jobs_added != setup->que.jobs_done)\
pipe_condvar_wait( setup->que.que_done_condvar, setup->que.que_mutex );\
pipe_mutex_unlock( setup->que.que_mutex );\