In a multiple producer-single consumer setting, is there a built-in concurrency control mechanism among the producer processes that are calling send() on the message_queue?
What happens if there are multiple instances of the consumer processes all calling receive() on the message_queue?
To the question whether
message_queueis thread-safe, the answer is yes.message_queueis implemented in terms ofshared_memory_objectusing some control structures (ipcdetail::mq_hdr_t) which include synchronization primitives (likeinterprocess_mutex).These are used to prevent unguarded concurrent access.