We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bc10764 + 779cc0e commit 2f75b94Copy full SHA for 2f75b94
1 file changed
include/thread_pool/thread_pool.h
@@ -235,7 +235,8 @@ namespace dp {
235
* @details This function will block until all tasks have been completed.
236
*/
237
void wait_for_tasks() {
238
- if (in_flight_tasks_.load(std::memory_order_acquire) > 0) {
+ // must be a while loop to ignore spurious wake-ups
239
+ while (in_flight_tasks_.load(std::memory_order_acquire) > 0) {
240
// wait for all tasks to finish
241
threads_complete_signal_.wait(false);
242
}
0 commit comments