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]

Status of guile1.3 and threads under Linux.



Is thread blocking (as opposed to process blocking) IO supposed to
work under Linux yet?

The reason I ask is that I need it, and from the NEWS.gz it looks like
it's at least partially supported:

  * Changes to the scm_ interface

  ** Function: int scm_internal_select (int fds,
                SELECT_TYPE *rfds,
                SELECT_TYPE *wfds,
                SELECT_TYPE *efds,
                struct timeval *timeout);

  This is a replacement for the `select' function provided by the OS.
  It enables I/O blocking and sleeping to happen for one cooperative
  thread without blocking other threads....

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)

Thanks

-- 
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930



-- 
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930