Boost logo

Boost Users :

Subject: [Boost-users] Boost 1.57.0 Message Queue Remove
From: SPONZA Cristiano (MM) (cristiano.sponza_at_[hidden])
Date: 2015-03-11 10:45:58


Hi,
about this topic I would have two questions. The scenario is simple: 1 sender and 1 receiver sharing a boost message queue.

Q1: If the sender removes the queue by the function remove("myQueue") how can the receiver to be aware the queue no longer exists? In my implementation the receiver uses the function timed_receive(...) and if the sender removes the queue the function returns false, since timeout is reached. The problem, in my case, is that the receiver cannot tell if the queue has been deleted or the sender is not sending messages anymore.

Q2: I experience a different behavior of the receiver depending on the language, C or C++.
Actually I created two receivers: recv.c and recv.cpp. The sender is written in C++.
The operations sequence is the following:

Sender:
- creates the queue "myQueue"
- writes some messages
- removes the queue
- terminates

Receiver:
- loops reading message on the queue "myQueue", applying timeout

Sender:
- restarts
- creates the queue "myQueue"
- ...

When the sender terminates, the receiver keeps to try reading. The queue has been removed, so the timed_receive(...) function goes in timeout.
When I restart the sender, the C++ receiver properly resumes reading the messages . With the C version, instead, the receiver is not able to resume and the receive function keeps going in timeout. Why the C++ version resumes while the C doesn't?

If the sender terminates leaving the queue as it is and then restarts, the C receiver resumes properly.
Unfortunately the implementation requires that if the sender has to terminate for any reason, the queue must be removed.

I hope I've been clear enough.
Thank you very much.

________________________________
VISITA IL NOSTRO NUOVO SITO WEB! - VISIT OUR NEW WEB SITE! www.magnetimarelli.com

Confidential Notice: This message - including its attachments - may contain proprietary, confidential and/or legally protected information and is intended solely for the use of the designated addressee(s) above. If you are not the intended recipient be aware that any downloading, copying, disclosure, distribution or use of the contents of the above information is strictly prohibited.
If you have received this communication by mistake, please forward the message back to the sender at the email address above, delete the message from all mailboxes and any other electronic storage medium and destroy all copies.
Disclaimer Notice: Internet communications cannot be guaranteed to be safe or error-free. Therefore we do not assure that this message is complete or accurate and we do not accept liability for any errors or omissions in the contents of this message.



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