Brian Candler wrote: > Sorry, I've read that several times and I still don't understand. Can > you post a small example which demonstrates the problem, preferably > standalone? My apologies: I'll see if I can elaborate a bit... Well, I originally was trying to find a workaround to this, but it seems the root of the problem is in the process' streams. I have a seperate program that I did not create myself (and therefore cannot change the code of) - this program puts output into stderr, and accepts input through stdin. I call Open3.popen3 to create the three streams. In a loop, I want to constantly read input from stderr. (Assuming I assigned the pipes to stdin, stdout, and stderr variable names.) loop do line = stderr.gets() puts("Output: #{line}") end Then, if I receive an output of say, 0, I want to input something to the program through stdin five seconds later. loop do line = stderr.gets().strip() puts("Output: #{line}") if(line == "0") Thread.new() do sleep(5) stdin.puts("Received 0 five seconds ago.") end end end It creates the thread properly, but when the sleep expires and it is ready to call stdin.puts(), it cannot do anything, because the loop continued around and it is reading from stderr. However, when it receives a new set of input from stderr, since the stream is momentarily being unused, it can then grab the stdin stream and properly input the old line. As I mentioned before, I tried using select on stderr so that it wouldn't tie up the stream, yet I've been told select only works properly with sockets on Windows. Brian Candler wrote: > If that's broken on Windows, your best option is to upgrade to a real > operating system :-) Can't argue with you there :) Robert Klemme wrote: > What things do you want to "write" and "read" and what do all your > threads do otherwise (i.e. when not reading or writing)? See: the above example. If you need a different one, just ask. -- Posted via http://www.ruby-forum.com/.