"is std::queue thread safe with producer and multiple consumers" Code Answer


you must protect access to std::queue. if you are using boost protect it using boost::mutex. now if you have multiple readers and one writer thread look at boost::shared_lock (for readers) and boost::unique_lock(for writer).

however if you will encounter writer thread starvation look at boost::shared_mutex.

By Derek Morrison on March 4 2022
Only authorized users can answer the Search term. Please sign in first, or register a free account.