>
> In Richard Stevens book, under the section for Message queues I found
the
> statement that msgrcv will unblock when either
>
> a) there is data
> b) the queue has been removed from the system and an error EIDRM is
returned
> c) a signal is caught and returns in which case the error is set to
EINTR.
>
> Could someone please clarify what that (c) means. Are there any
signals
> that "return" by default?
>
> Thanks,
> scott.
Look at your man pages for sigaction(). Basically, if you set up a
procedure to handle a signal delivered to your process, when the signal
is recieved, that procedure is invoked. In general, when the procedure
completes, control is passed to the statement following the point at
which the signal was received. In your case, suppose you received a
SIGCLD from an exiting child process while you were in the process of
doing the msgrcv(). Your SIGCLD handler would do it's thing and then
return control to the statement following the msgrcv(). The return from
msgrcv() will be -1 and errno will be set to EINTR, indicating that the
msgrcv() call was interrupted. In general, it is good practice to put
the msgrcv() in a while loop that tests for a -1 return and errno ==
EINTR so that you go back to the msgrcv() if you are interrupted.
hth
--
John H. Simpson Phone: 503-450-2667 FAX: 503-450-3629
CNF AdTech Center. (CNF, Inc.)
1717 NW 21st St.
Portland, OR 97209 USA