Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2020-07-11 07:27:07


On 10/07/2020 17:07, Sean Farrow via Boost-users wrote:
> Good afternoon,
>
> I am looking to use the message queue in the Interprocess library to
> communicate between two Windows processes.
>
> I was wondering whether there was an in-built mechanism to signal to the
> process reading from the queue that a message is available for consumption.

No, there isn't.

> If there isn’t anything in-built, I was wondering what the best way to
> do this is and whether anybody has any working sample code they would be
> willing to share?

If the notification has to be asynchronous, then you need to use
os-specific mechanism, like signals. If you need to support Windows,
then you need to use windows-specific mechanisms, you can look
alternatives to signals here:

https://docs.microsoft.com/en-us/previous-versions/ms811896(v=msdn.10)?redirectedfrom=MSDN#ucmgch09_topic3

Another way is to launch a background thread and check for an
interprocess-mechanism like a named semaphore or similar and notify
internally your processing thread to check the message queue. Not
simple, but I can't think about any easy alternative.

Best,

Ion


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net