[interprocess] Many-to-many communication
I have an application which needs to communicate with several other applications on the same machine. I thought to use message queues but quickly ran into a problem: Either I create as many threads as there are message queues which all block and wait for incoming data or I constantly poll all message queues. The later should be easily possible with try_receive(). However it doesn't sound like a good idea to poll continuously? And I assume integrating the message queue somehow into Boost.Asio is not something easily possible? Thus for many-to-many communication shared memory is probably the way to go? Boris
Boris wrote:
I have an application which needs to communicate with several other applications on the same machine. I thought to use message queues but quickly ran into a problem: Either I create as many threads as there are message queues which all block and wait for incoming data or I constantly poll all message queues. The later should be easily possible with try_receive(). However it doesn't sound like a good idea to poll continuously? And I assume integrating the message queue somehow into Boost.Asio is not something easily possible? Thus for many-to-many communication shared memory is probably the way to go?
I'm sorry to tell you that the integration between ASIO and Interprocess is not easy. Since many times (nearly always) the OS does not offer this notification mechanism to trigger asynchronous notifications, polling would be the only choice for a ASIO plug-in. Maybe in some systems with native process-shared semaphores, we could put a thread blocked in that semaphore so that once a message is written the thread notifies ASIO machinery. Although I'm afraid that this idea would take a long time to be implemented. Regards, Ion
On Tue, Feb 26, 2008 at 6:28 AM, Boris
I have an application which needs to communicate with several other applications on the same machine. I thought to use message queues but quickly ran into a problem: Either I create as many threads as there are message queues which all block and wait for incoming data or I constantly poll all message queues. The later should be easily possible with try_receive(). However it doesn't sound like a good idea to poll continuously? And I assume integrating the message queue somehow into Boost.Asio is not something easily possible? Thus for many-to-many communication shared memory is probably the way to go?
You can use a mix of shared memory (interprocess) and socket communication for notifications.
Boris
Regards, -- Felipe Magno de Almeida
participants (3)
-
Boris
-
Felipe Magno de Almeida
-
Ion Gaztañaga