-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: Improve test & fix race condition in thread pool
It could sometimes happen that we enqueue a small amount of work, and then manage to lock the pool mutex in a subsequent call to thread_pool_wait() before any threads managed to grab any work. Since we didn't check if the pool has any queued work, it could happen that we continue executing on the main thread assuming the pool is done working, when in reality it actually just started working. Simple fix, just check if there is work to be done, and block as long as we do.
- Loading branch information
Showing
2 changed files
with
25 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters