On Tue, May 09, 2006 at 02:53:27PM +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.

There's no way to select or poll message queue, unfortunately, so you
have to manually poll it every so often. To poll, use either a
non-blocking msgrcv() or msgctl(qid, IPC_STAT, &buf) and look at
buf.q_qnum. If it's > 0, you have a message waiting.

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]

Reply via email to