On Thu, Sep 29, 2011 at 01:11:49PM +0200, Jörg F. Wittenberger wrote: > On Sep 29 2011, Alan Post wrote: > > >Below is a test case for a problem I'm seeing in some multi-process > >code I'm writing. I'm getting the error: > > > > Error: (file-read) cannot read from file - Interrupted system call > > There are two ways to fix that: either make the posix unit thread safe > (recall my recent message how to avoid process-wait having a bad effect). > > The other one is working around the problem. That's what I'm doing based > on some code Felix supplied ages ago. It wraps the file descriptors > into custom ports those are properly restarted on EINTR. > > However I'd be rather interested to learn what exactly the problem is > you observe. Recently (maybe 4.7.3 or .4) I'm seeing missbehavior > from formerly well working code. I can't say that's chickens fault > but neither I can say it's not. >
If I understand the part of the code below that wraps read/write, it can't be used as-is for my problem. Because chicken defers signals, a signal is delivered, deferred, then read/write return with EINTR. If I immediately restart these syscalls (all in the same C call), the deferred signal has not be delivered, and the code deadlocks, as read/write pauses--blocking the signal handler from ever being run. I need a way to deliver deferred signals after a syscall returns EINTR, before restarting that syscall. You may well not notice this in non-blocking code, as no data would be ready on the file descriptor and the code would continue running--eventually to deliver the deferred signal and unwedge everything. -Alan -- .i ma'a lo bradi cu penmi gi'e du _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users