From: Michal Suchanek Date: 2008-08-07T22:27:52+09:00 Subject: Re: Threaded IO trouble On 07/08/2008, Michal Suchanek wrote: > On 07/08/2008, Robert Klemme wrote: > > 2008/8/7 Michal Suchanek : > > > > > On 07/08/2008, Robert Klemme wrote: > > >> > > >> And it misses another line at the beginning: > > >> > > >> $defout.sync = true > > >> > > >> :-) > > > > > > Fixing the mockup is not the right way, > > > > > > Maybe I am missing your point but the buffering in the mock client is > > certainly delaying the complete process. Also, I did not only add > > that line to mock.rb but provided a different client implementation. > > Did you actually try it out? > > > Sorry, I did not try that yet. > Well, I did not quite understand how your client maps to my client, and it is indeed completely different. While your client does only one popen my client does numerous popens. This is necessary to work around the buffering: the pipe is closed every time so that the application knows it's time to print out the rest of the output. Your client is indeed very slow with the mockup and might fail completely with the application I use. I haven't explored the option of using an EOF marker instead of closing the pipe too much. Maybe that would be the option that works around limitations in both my application and Ruby. As for duplication the IO using a fd: I was unsure it is safe to use a single IO structure in two threads. Thanks Michal