From: Nat Pryce Date: 2001-09-28T01:16:43+09:00 Subject: [ruby-talk:21777] Re: opening a named pipe? From: "Michael Witrant" > Do you mean there is no way for ruby to run anything else while it is > waiting for a pipe? > Is waiting for a pipe different from reading a file, calling 'system', > or any other blocking system call? > My ruby threads usually run normally even if any other thread is waiting > for a file, or sleeping for any reason (including system calls). Why is > this different when I open a named pipe? I'm making educated guesses here from my experience of using other user space thread packages... Because Ruby uses lightweight (user-space) threads, the implementation of the thread scheduler and I/O must cooperate to switch out threads that are doing blocking I/O. I expect that Ruby implements thread switching for read and write calls, but not for open calls, because opening a file or socket is usually an instantaneous operation. However, a process opening a named pipe waits in the *open* call for another process to rendezvous at the other end of the pipe. To block threads that open named pipes, the Ruby implementation must probably be extended to also switch out threads that make blocking open calls. Cheers, Nat.