[gambit-list] How to do pipe?

Taylor R Campbell campbell at mumble.net
Thu Jun 18 12:34:05 EDT 2009


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