diff --git a/src/scheduler.c b/src/scheduler.c index b2babbde518f1767b0df7d47ec3dcdb85de124b9..f7fef871528ad299645a07415ade487fa3e239fb 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1011,6 +1011,7 @@ void scheduler_start(struct scheduler *s, unsigned int mask, /* Wait for the rewait tasks to have executed. */ pthread_mutex_lock(&s->sleep_mutex); + pthread_cond_broadcast(&s->sleep_cond); while (s->waiting > waiting_old) { pthread_cond_wait(&s->sleep_cond, &s->sleep_mutex); } @@ -1032,6 +1033,11 @@ void scheduler_start(struct scheduler *s, unsigned int mask, } } + /* To be safe, fire of one last sleep_cond in a safe way. */ + pthread_mutex_lock(&s->sleep_mutex); + pthread_cond_broadcast(&s->sleep_cond); + pthread_mutex_unlock(&s->sleep_mutex); + // message( "enqueueing tasks took %.3f %s." , // clocks_from_ticks( getticks() - tic ), clocks_getunit()); }