diff --git a/src/queue.c b/src/queue.c index dba27a663e71fb22698995916b4f79f8d2197a27..3820267ee2fa1f2663d83ce07e5df7ed31957e1c 100644 --- a/src/queue.c +++ b/src/queue.c @@ -146,20 +146,19 @@ struct task *queue_gettask ( struct queue *q , int qid , int blocking ) { lock_type *qlock = &q->lock; struct task *qtasks, *res = NULL; struct cell *ci, *cj; - TIMER_TIC /* If there are no tasks, leave immediately. */ - if ( q->count == 0 ) { - TIMER_TOC(timer_queue); + if ( q->count == 0 ) return NULL; - } /* Main loop, while there are tasks... */ while ( q->count > 0 ) { /* Grab the task lock. */ + TIMER_TIC if ( lock_lock( qlock ) != 0 ) error( "Locking the qlock failed.\n" ); + TIMER_TOC( timer_qlock ); /* Set some pointers we will use often. */ qtid = q->tid; @@ -264,7 +263,6 @@ struct task *queue_gettask ( struct queue *q , int qid , int blocking ) { } /* while there are tasks. */ /* Take the money and run. */ - TIMER_TOC(timer_queue); return res; } diff --git a/src/timers.h b/src/timers.h index 071ee6a7220135e7cd39e8353334d176407d78e9..e192e327328f61b03c699d29ecad7ae33f046ca1 100644 --- a/src/timers.h +++ b/src/timers.h @@ -35,7 +35,7 @@ enum { timer_dopair_subset, timer_doghost, timer_gettask, - timer_queue, + timer_qlock, timer_stalled, timer_runners, timer_step,