Answer the question
In order to leave comments, you need to log in
STL queue - thread-safe for push/pop?
If push() of a new element is executed in one thread, and in another
if (!queue.empty()){
element = queue.first();
queue.pop();
}
Answer the question
In order to leave comments, you need to log in
All STL containers are not thread safe unless otherwise noted. The reason is simple - the inevitable loss of performance in cases where thread safety is not needed.
Remember C++ is made for the developer's freedom of choice. Take a break from this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question