mirror of
https://github.com/libretro/libretro-common.git
synced 2024-11-23 08:09:43 +00:00
Wait until there is any work item to be done (#208)
This is for handling a rare case when all threads are free without any work (working_cnt == 0) but there exist some work items that are not yet done or not yet started to be processed.
This commit is contained in:
parent
0df91cc414
commit
01c6122931
@ -258,7 +258,7 @@ void tpool_wait(tpool_t *tp)
|
||||
/* working_cond is dual use. It signals when we're not stopping but the
|
||||
* working_cnt is 0 indicating there isn't any work processing. If we
|
||||
* are stopping it will trigger when there aren't any threads running. */
|
||||
if ((!tp->stop && tp->working_cnt != 0) || (tp->stop && tp->thread_cnt != 0))
|
||||
if ((!tp->stop && (tp->working_cnt != 0 || tm->work_first != NULL)) || (tp->stop && tp->thread_cnt != 0))
|
||||
scond_wait(tp->working_cond, tp->work_mutex);
|
||||
else
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user