This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Rob Browning <rlb@cs.utexas.edu> writes: > Is thread blocking (as opposed to process blocking) IO supposed to > work under Linux yet? No, it's only partially implemented. > But if I try something to test it (assuming my test isn't broken), it > seems like it's not working. This code is supposed to keep printing > "foo" every 2 seconds, even after the call to block-on-pipe that > should block the main thread (before trying this code, make sure to > run "mkfifo ./bar.sock" from the shell first). > > (call-with-new-thread > (lambda () > (do () > (#f) > (sleep 2) > (display "foo\n"))) > (lambda () ())) > > (define (block-on-pipe) > (let ((port (open-file "./bar.sock" "r"))) > (display port) > (read-char port))) > > (block-on-pipe) In order for thread blocking to work, we need to use scm_internal_select for blocking at all places where the process could potentially block. It is currently implemented only for single character reads from file ports. This is not as restrictive as it sounds since `read' is currently implemented using single-char reads, and since file ports include ttys and pipes. However, in your example, (block-on-pipe) will block on "open", thereby blocking the process. /mdj