[fxruby-users] building for 1.9

Lyle Johnson lyle at lylejohnson.name
Tue Apr 1 17:47:47 EDT 2008

On Tue, Apr 1, 2008 at 3:10 PM, Steven Parkes <smparkes at smparkes.net> wrote:

>  You mentioned in a couple of places that you'd been looking at making fxruby
>  work on 1.9.
>  Does that get rid of (or at least obviate the need for) the idle chore?
>  Since 1.9 uses native threads, can one expect real concurrency, at least to
>  the extent that the two event-loops/schedulers could do their blocking
>  selects (or the moral equivalent) independently ...

Let me preface my remarks by noting that what I don't understand about
multi-threading issues is "a lot". I am always open to suggestions, or
better yet, patches. ;)

Because I haven't had a chance to take a hard look at how threads work
in Ruby 1.9, the way that FXRuby *currently* handles threads in Ruby
1.9 hasn't changed. The FOX event loop is in charge, running in the
primary thread, and it sets up a chore that periodically yields time
to Ruby's thread scheduler. If there's a way I can modify this so that
the event loop thread cooperates with the Ruby thread(s) in a more
straightforward way, I'm open to that. It might simply involve
invoking the FXApp#run method in a Ruby thread.

It may be worth noting that chores are fundamentally different from
threads in that they are only "scheduled" when the event queue
empties. You're not guaranteed that chores will run on a regular
basis, whereas a thread scheduler's job is to ensure that each thread
gets its fair shake. An advantage of using chores is that, since they
run in the same thread as the event loop, you don't have to worry
about the usual concerns associated with multi-threaded applications.

>  I thought I'd try first, rather than ask, but I haven't quite figure out how
>  to do a 1.9 build.
>  Trying to build 1.6.14, I get bollixed up on extconf.rb wanting ftools,
>  which isn't in 1.9 (as far as I can tell ...) I could go down the path of
>  figuring out tweaks to make that work, but ...

OK. You may be able to just remove that require statement (for
'ftools') and get it to work, but either way I'll look into this
before the next release. I think the last time I tried to build it
against Ruby 1.9 was before the 1.9.0 release so I suspect some things
changed in the final release.

>  I also looked at building from trunk, but there is no extconf.rb ... I'm not
>  sure where that little piece of magic is supposed to come from (but I have
>  rather limited experience when it comes to doing much beyond "gem build" and
>  "gem install" with rubygems).

The trunk version is the development branch for FXRuby 1.8, and it's
definitely not building at the moment. The FXRuby 1.6 code lives on
the RB-1.6 branch, but even there, what you get when you check out the
code isn't identical to what's distributed in the source tarballs and
gems. Many of the distribution files (including extconf.rb) are
automatically generated from templates by a Rake task and aren't
actually checked in to the Subversion repository.

[1] http://www.infoq.com/news/2007/05/ruby-threading-futures

More information about the fxruby-users mailing list