[InterProcess] receiving notification when an item is added to the message queue

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[InterProcess] receiving notification when an item is added to the message queue

Boost - Users mailing list

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.

 

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?

 

Any help appreciated as always.

 

Kind regards

Sean.


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [InterProcess] receiving notification when an item is added to the message queue

Boost - Users mailing list
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 mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users