From: Guillaume Marcais Date: 2005-10-21T03:49:09+09:00 Subject: Re: wxruby unfriendly to Ruby threads? On Thu, 2005-10-20 at 12:57 +0900, Wink Saville wrote: > Guillaume Marcais wrote: > > >I have a GUI application with a bunch of threads proxying network > >information around. But the network communication seems very slow if not > >stopped. To make sure, I added a "keep alive" thread: > On my system running windows I need to redefine puts as below to flush > the output: > > def puts(s) > STDOUT.puts(s) > STDOUT.flush > end > > As for the threads, how many is a bunch? I am using net-ssh, which uses threads internally, so my count is only approximated. I guess between 10 and 15 threads, mostly waiting on sockets. The total amount of traffic going through is not huge, but it has to keep flowing or the applications consider the connection to be lost fairly quickly. > I've been looking at the > scheduler and it looks to me that each time a thread is scheduled the > entire list of threads is looped through at least twice and as many as 5 > times. I'm looking into other possible algorithms, but I'm a newbie so > not sure what progress I'll make. But it looks to be an interesting > problem and I believe it is solvable. Well, it seems that, some reasons, the threads are not scheduled if no GUI activity is there. If I keep moving my mouse over my application window, the forwarding works, if I stop, it hangs and disconnect. By the way, the platform is Linux, but eventually the code will be ported to Windows too. In the end, I think I'll spawn off a separated process (and communicate with Drb most likely) to do the net-ssh trickery. After reading on how threading works with wxRuby, I feel uneasy keeping everything in the same process and having the IO so much under the control of the GUI library. Guillaume. > Cheers, > > Wink > >