Removed exponential polling in thpool_wait and replaced it with waiting on a pthreads condition variable. When a thread goes into idle, it signals if num_threads_working becomes 0.
Tested on basic, pause/resume, and wait test cases.
I might in the near future look into cleaning up the job queue synchronization (esp. regarding the bsem) but it would be a bigger refactoring.
Removed exponential polling in thpool_wait and replaced it with waiting on a pthreads condition variable. When a thread goes into idle, it signals if num_threads_working becomes 0.
Tested on basic, pause/resume, and wait test cases.
I might in the near future look into cleaning up the job queue synchronization (esp. regarding the bsem) but it would be a bigger refactoring.