On Tue, May 09, 2006 at 03:24:02PM +0300, Omer Zak wrote: > On Tue, 2006-05-09 at 14:53 +0300, Ori Idan wrote: > > I need to sleep until a message is aviliable in a message queue. > > > > I can do it using msgrcv, however it will remove the message from the queue. > > > > Is there a way to do it without removing the message? I juast want to > > wake up and not read the message yet. > > DISCLAIMER: the following suggestions were not actually tested. The > first two will probably work. The third depends upon correctness of the > information in the manpage. > > 1. Have the sending process send two messages each time. The first > message is used to wake up the receiving process and then discarded. It > could be zero-length message.
Isn't this racy - if the sender context switches between the two sends, the receiver may block on the second receive. Cheers, Muli -- Muli Ben-Yehuda http://www.mulix.org | http://mulix.livejournal.com/ ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]