4 ms·
I don't have the most experience writing concurrent code but wouldn't semaphores have made more sense here? The issue was that condition variables aren't "stick
by James_K 3y ago
I don't have the most experience writing concurrent code but wouldn't semaphores have made more sense here? The issue was that condition variables aren't "sticky" yet semaphores are and so would not have that problem.
- jlokier 3y agoA condition variable is used because the workers are waiting for a condition, `m_queue.size() > 0`, in addition to the kill flag. The kill flag is sticky, but the queue condition isn't.