Laurent Sansonetti
lsans****@apple*****
Thu Jul 5 07:59:56 JST 2007
Hi, As you could see from the recent SVN activity, I merged Jonathan Paisley's patches to make Ruby threads work with RubyCocoa. The objective is to save and restore the per-thread Foundation contextual data, such as autorelease pools and exception handlers. This is required because Ruby threads are not native threads, but emulated. The RubyCocoa part of Jonathan's work has been committed, with some little modifications. This includes Tiger support, only. For systems higher than Tiger, please contact me privately, as I cannot commit the code for now. The Ruby part of the work is available as misc/ruby_thread_hooks.diff. This is a patch for the 1.8 Ruby releases, it works well on the latest 1.8.6 p36 release but it should also work with previous releases of the 1.8 branch. The patch must be applied if you want to use Ruby threads with RubyCocoa. It is not necessary to apply the patch before building RubyCocoa. If the Ruby patch hasn't been applied and you try to create a Ruby thread, you will get an exception. You can avoid this by setting the RUBYCOCOA_THREAD_HOOK_DISABLE environment variable, but it is highly recommended to patch the Ruby interpreter. We can eventually transform the exception to a warning. Please give it a try! On my environments, the new threading tests (in tc_thread.rb) are now passing, which is a very big news. It would be great to have a sample application that uses lots of Ruby threads, I will see if I can write one. Laurent