signals interrupting IPC functions

David F. Carlson dave at micropen
Sat Sep 24 02:06:42 AEST 1988


In article <216 at ISIDAPS5.UUCP>, mike at ISIDAPS5.UUCP (Mike Maloney) writes:
> When a call to msgrcv terminates because of the arrival of a signal,
> is it possible that a message on the queue could be lost?  I want
> to be able to read a message queue and process messages as soon as
> they arrive, or timeout and do other stuff after 3 seconds:
> 	s = msgrcv(id, buf, size, 0, 0);
> 	{	if (errno == EINTR)
> 
> Please confirm my fears or set my mind at ease.
> Mike Maloney				"That's like saying 'if we had

RTFM:  signal(2):
"When a signal to be caught occurs during read(2), a write(2), an open(2),
an ioctl(2) or system call to a slow device, ... during pause(2) or wait(2),
... the system call may return -1 to the calling process with errno set
to EINTR."

No mention of msgrcv(2) at all.  I believe since it is not mentioned, it
is guaranteed not to occur.



-- 
David F. Carlson, Micropen, Inc.
micropen!dave at ee.rochester.edu

"The faster I go, the behinder I get." --Lewis Carroll



More information about the Comp.unix.questions mailing list