In all honesty, I hadn't used the make-input-port procedure before. It didn't occur to me to use that to make a nonblocking input port. Your code snippet seems to solve the problem quite a bit better than my egg does.
Is open-input-file*/nonblock in a currently released egg? On Thu, Jul 7, 2016 at 6:04 AM, Kristian Lein-Mathisen < [email protected]> wrote: > I don't know how useful this is, but I though I'd throw in a test I use as > we've encountered this a few times as well in the posix egg: > > > (use posix srfi-18) > > (define mythread > (thread-start! > (lambda () > (let loop () > (define start (current-milliseconds)) > (thread-sleep! 0.1) > (define elap (- (current-milliseconds) start)) > (if (> elap 500) ;; the 0.1 second sleep took > 0.5 seconds! > (print "OBS! elap = " elap) > (loop)))))) > > (print "cmd: sleep 1 ; echo hi" (with-input-from-pipe "sleep 1.5 ; echo > hi" read-string)) > (thread-join! mythread) > > $ csi -version > Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b) > linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ] > bootstrapped 2014-06-07 > $ csi -s blocking-io-test.scm > cmd: sleep 1 ; echo hihi > > OBS! elap = 1512.0 > > > And this is a code-snippet > <http://paste.call-cc.org/paste?id=69742cf6f54afbe2401e0ee8c67ade35a3d6a07a> > we > use to solve it. > > > K. > > On Fri, Jul 1, 2016 at 6:53 PM, Matt Welland <[email protected]> > wrote: > >> >> >> On Fri, Jul 1, 2016 at 3:11 AM, Andy Bennett <[email protected]> >> wrote: >> >>> Hi, >>> >>> > And of course, reads of files on the file >>> > system never block at all >>> >>> A read from a file can block when the operating system needs to go to >>> disk for the data. This happens when the buffer empties and it cannot be >>> refilled before the next read call. >>> >> >> I don't know if it applies to this discussion but read blocking can be >> quite a pain when a network fileserver such as NFS goes offline. It would >> be nice if other threads would continue so that the program could detect >> the issue and potentially take appropriate action such as let the user know >> *why* the program is hung. >> >> >>> >>> >>> >>> >>> >>> Regards, >>> @ndy >>> >>> -- >>> [email protected] >>> http://www.ashurst.eu.org/ >>> 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF >>> >>> >>> _______________________________________________ >>> Chicken-users mailing list >>> [email protected] >>> https://lists.nongnu.org/mailman/listinfo/chicken-users >>> >> >> >> _______________________________________________ >> Chicken-users mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/chicken-users >> >> > > _______________________________________________ > Chicken-users mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/chicken-users > >
_______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
