From: "Iñaki Baz Castillo" Date: 2010-01-08T06:26:08+09:00 Subject: Re: Non-blocking communication between Ruby processes El Jueves, 7 de Enero de 2010, Eric Wong escribió: > Iñaki Baz Castillo wrote: > > El Jueves, 7 de Enero de 2010, Robert Klemme escribió: > > > > Yeah, I gathered that from your other posts. The general point, > > > > though, still applies: check the pipe's size, and if it grows too > > > > large, spin off a new reading thread. > > > > > > That's something different than you proposed initially, isn't it? This > > > approach (increasing the number of readers if the pipe fills too fast) > > > is better because it regulates read performance according to load. > > > > Definitively I have no idea of how to know the status of a FIFO (not a IO > > pipe but a FIFO file). The only it occurs when it's full (because no > > reader is getting the data) is that the writer #flush operation gets > > blocked. I've found no way to determine how "full" is a FIFO file. > > FIFO are pipes, they just have a name on the filesystem. > > In any case, use IO#write_nonblock. Any writes you do will raise > Errno::EAGAIN if your FIFO/pipe is full. > > See the pipe(7) manpage on a Linux machine, it provides a great overview > of pipe semantics for blocking/non-blocking operations. Thanks, I'll do. -- Iñaki Baz Castillo