From: Michal Suchanek Date: 2008-08-08T02:22:58+09:00 Subject: Re: Threaded IO trouble On 07/08/2008, Robert Klemme wrote: > Well, that obviously depends on the application you are using for > filtering. If it will send out the last output only on termination there is > no other way than to create new processes over and over again. Of course, > this is not really efficient - especially for short lived processes - no > matter what programming language you use. I am under the impression it is so. Using single instance of the application did not work so far. However, there are at least two markers that could be possibly used for input termination so it might be worth experimenting with that a bit. Still even if it is possible to run a single instance ruby should be able to run multiple instances, too. > > > > Your client is indeed very slow with the mockup and might fail > > completely with the application I use. > > > > I am not sure what you mean by "slow". I hope you noticed the sleep in > there. > Oh, yeah, no ehmm.. > > > 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. > > > > So the application that replaces mock.rb is under your control? I was > assuming that it is not and you need to work with it as is. In that case > you should certainly introduce some kind of signaling for the end of one > chunk of data (if that is needed). Unfortunately it is not. If it was so I would use a saner interface in the first place. > > > > As for duplication the IO using a fd: I was unsure it is safe to use a > > single IO structure in two threads. > > > > It is because you are using it in one direction in each thread only. Thanks Michal