From fe7031e02a1494ab4e9152dc194b3966a203b06a Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <pedro.gonnet@durham.ac.uk> Date: Mon, 8 Jul 2013 09:24:51 +0000 Subject: [PATCH] sleep on scheduler_gettask util anything becomes available. Former-commit-id: fd087581d3c05432b1cadc2d6cd961516a678780 --- src/scheduler.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/scheduler.c b/src/scheduler.c index 63b25e0b86..281e0157e5 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -808,11 +808,11 @@ struct task *scheduler_done ( struct scheduler *s , struct task *t ) { /* Task definitely done. */ if ( !t->implicit ) { t->toc = getticks(); - // pthread_mutex_lock( &s->sleep_mutex ); + pthread_mutex_lock( &s->sleep_mutex ); if ( next == NULL ) atomic_dec( &s->waiting ); - // pthread_cond_broadcast( &s->sleep_cond ); - // pthread_mutex_unlock( &s->sleep_mutex ); + pthread_cond_broadcast( &s->sleep_cond ); + pthread_mutex_unlock( &s->sleep_mutex ); } /* Start the clock on the follow-up task. */ @@ -881,12 +881,12 @@ struct task *scheduler_gettask ( struct scheduler *s , int qid , struct cell *su } /* If we failed, take a short nap. */ - /* if ( res == NULL ) { + if ( res == NULL ) { pthread_mutex_lock( &s->sleep_mutex ); if ( s->waiting > 0 ) pthread_cond_wait( &s->sleep_cond , &s->sleep_mutex ); pthread_mutex_unlock( &s->sleep_mutex ); - } */ + } } -- GitLab