Skip to content
Snippets Groups Projects
Commit fe7031e0 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

sleep on scheduler_gettask util anything becomes available.

Former-commit-id: fd087581d3c05432b1cadc2d6cd961516a678780
parent d16a2cd2
No related branches found
No related tags found
No related merge requests found
......@@ -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 );
} */
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment