Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I develop an interactive protocol on C++ between N processes that communicate with each other via boost message_queue queues. One of the processes has 2 execution threads, a main thread that uses the queues, and a "helper" thread which listens to messages that are accepted on one of the queues, and if needed, sends new messages to other processes by using the queue.

Does boost message queues support usage of multiple threads with them in terms of synchronization between the threads, sleep of a single thread in case waiting for a message, etc? The threads library I use is the boost thread library.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I am not entirely sure I understand the question, but Boost.Interprocess's message_queue is thread-safe. The receive() member function allows for the caller to block, waiting for a message. Reading with timeouts can be accomplished by using timed_receive().

share|improve this answer
    
Yes, probably the word I should've used was "thread safe". Thank you very much! :> – Edgepo1nt Jun 13 '13 at 11:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.