On Tue, 2006-05-09 at 15:42 +0300, Muli Ben-Yehuda wrote:
> 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.

1. You are right.
2. Might be acceptable in Ori's specific application (the sender process
being the top priority one, or sending both messages inside a locked
region).
3. There are also two other suggestions.
                                                 --- Omer
-- 
Sent from a PC running a top secret test version of Windows 97.
My own blog is at http://tddpirate.livejournal.com/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html


=================================================================
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]

Reply via email to