Is there a built-in concurrency control in boost::interprocess::message_queue?

51 Views Asked by At

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?

1

There are 1 best solutions below

0
sehe On BEST ANSWER

To the question whether message_queue is thread-safe, the answer is yes.

message_queue is implemented in terms of shared_memory_object using some control structures (ipcdetail::mq_hdr_t) which include synchronization primitives (like interprocess_mutex).

These are used to prevent unguarded concurrent access.