[fxruby-users] Re: FXRuby and Threads (was: radiobuttons are weird in 1.2.x series)

Lyle Johnson lyle at knology.net
Thu Jul 22 08:46:22 EDT 2004


On Jul 21, 2004, at 5:21 AM, Bil wrote:

> I've had the same problem with data targets, and fixed them by 
> disabling threads as you have (win2k/Ruby1.8.1/FXRuby1.0.28). I'm not 
> sure, though, what exactly is disabled by this action. A client/server 
> application of mine uses Ruby threads and synchonises with these 
> threads using app.addTimeout (maybe not the best method, but fine for 
> me). It seems to work fine without "threads"? I couldn't find any 
> documentation as to what is actually affected.

The basic problem is that there's a conflict between FOX's event loop, 
which wants to be in charge, and Ruby's thread scheduler, which also 
wants to be in charge. In order to avoid changing either Ruby's or 
FOX's source code, we've made a compromise which isn't great but is the 
best I could come up with.

When FXRuby's support for Ruby threads is enabled, a special background 
chore [1] is kicked off. That chore causes the FOX event loop to yield 
some small amount of time to Ruby's thread scheduler every so often, so 
as to let other threads in the application run. The side effect is that 
some of that free time that FOX would have used, say, to update your 
data targets, is now being "stolen" by other threads.

Now, if FXRuby's support for Ruby threads is disabled, FOX is greedy 
and never lets any of the other threads run. So I'm a little suspicious 
when you say that your client-server application's other threads are 
able to run after you've called FXApp#disableThreads. Maybe something 
has changed in Ruby's threads implementation recently?

Lyle

[1] A chore is a task that runs during idle time in the FOX event loop.



More information about the fxruby-users mailing list