[uClinux-dev] SIGALRM and msgrcv

Robert Daniels RobertD at vantagecontrols.com
Tue Nov 19 19:59:54 EST 2002

	I'm attempting to use SysV IPC message queues and I'd very much like
a timeout on the msgrcv function, so I'm trying to use setitimer to create
an alarm that will go off after my wait time to interrupt the msgrcv.  Now,
my problem occurs when the timeout is very short, such as 10 milliseconds.
I'm still not totally clear on what's going on, but from what I've been able
to observe, occasionally, at about the timeout time, I receive a message
which exits msgrcv before the alarm.  I then cancel the timer, process the
message, then set the timer, and do another msgrcv.  It appears that during
that process, my alarm fires and is not handled, but gets put into the
signals pending mask before schedule() is called in the sys_msgrcv function.
What I then get is a sleeping process with a SIGALRM pending.  If I send a
signal that I'm handling, such as SIGIO, then the process wakes up and
things are normal again.  This is also true if a message is received.

	I'm trying to figure out how to avoid this and still have a msgrcv
with a timeout - does anyone have any ideas on this?  I would have thought
that the SIGALRM would get handled at some point (preferably as close to the
specified time as is convenient), but sadly it doesn't.  Is this supposed to
be possible/valid under linux/uClinux?  

System info: 
	uClinux 2.4.x
	MCF5272 processor on my own board
	uClibc 0.9.15.

Thanks for any ideas or helpful hints!

Robert Daniels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20021119/258d3478/attachment.html>

More information about the uClinux-dev mailing list