"is using std::deque or std::priority_queue thread-safe? " Code Answer

4

from scott myer's effective stl item 12. have realistic expectations about the thread safety of stl containers

multiple readers are safe. multiple threads may simultaneously read the contents of a single container, and this will work correctly. naturally, there must not be any writers acting on the container during the reads.

multiple writers to different containers are safe. multiple threads may simultaneously write to different containers.

when it comes to thread safely and stl containers, you can hope for a library implementation that allows multiple readers on one container and multiple writers on separate containers. you can't hope for the library to eliminate the need for manual concurrency control, and you can't rely on any thread support at all.

By Michael Yuwono on September 5 2022

Answers related to “is using std::deque or std::priority_queue thread-safe? ”

Only authorized users can answer the Search term. Please sign in first, or register a free account.