Path: utzoo!attcan!uunet!husc6!mailrus!cornell!rochester!uhura.cc.rochester.edu!ur-valhalla!micropen!dave
From: dave@micropen (David F. Carlson)
Newsgroups: comp.unix.questions
Subject: Re: signals interrupting IPC functions
Summary: I don't think its a problem
Keywords: ...worried about data loss...
Message-ID: <548@micropen>
Date: 23 Sep 88 16:06:42 GMT
References: <216@ISIDAPS5.UUCP>
Organization: Micropen Dirent Writing Systems, Pittsford, NY
Lines: 27

In article <216@ISIDAPS5.UUCP>, mike@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@ee.rochester.edu

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