[gambit-list] How to do pipe?

Marc Feeley feeley at iro.umontreal.ca
Thu Jun 18 13:24:01 EDT 2009


You are correct.  EINTR is checked (in Scheme code) in a few critical  
places (like the read and write system calls), but all systems calls  
which can fail with EINTR should check it too.  This might explain why  
the problem was not reported earlier.

Marc

On 18-Jun-09, at 12:34 PM, Taylor R Campbell wrote:

> I glanced at some of the code in os-io.c.  In every system call I
> looked at, if the system call fails with EINTR, Gambit will signal a
> Scheme error.  This is almost certainly not what you want: for
> example, the delivery of SIGALRM may indicate that it's time to switch
> threads.  If a system call fails with EINTR but nothing interesting
> happened, you generally want to restart the system call.  Any system
> call may fail with EINTR.  Not taking EINTR into account, and instead
> signalling errors just about every time a system call returns -1, will
> cause these random errors to show up, with different frequency under
> different operating systems.
>
> Be careful, though, to actually check and handle events such as
> (Scheme) interrupts caused by (OS) signals, rather than simply
> restarting the system call on EINTR.  If you just restart the system
> call on EINTR, one Scheme thread can hang all the others, for instance
> by trying to do a file operation on a slow NFS mount, or by trying to
> open a named fifo with no one on the other end.  This is why you also
> don't want to set the SA_RESTART flag for all signals either (although
> it may be appropriate for some signals).




More information about the Gambit-list mailing list