ThreadSafeQueue is not thread safe for multiple readers #134
Open
Description
Calling front() and pop() when the queue is empty is undefined behavior.
There are no operations provided that check empty() and then access the container while holding the mutex the entire time.
If there are two threads that look like this:
while(true) {
if (!queue.empty()) {
queue.pop();
}
}
It is likely that the queue is not empty when one thread checks the conditional statement, but it is empty when it tries to call pop().
Metadata
Assignees
Labels
No labels