From: Jonathan P. <jp...@dc...> - 2005-11-25 10:27:40
|
On 25 Nov 2005, at 8:41, Neil Stevens wrote: > Dave Baldwin wrote: >> Run the long processing in a separate thread. > > That doesn't seem to work here, probably because ruby threads aren't > OS-level threads. It was the first thing I tried though, heh. OS-level threads don't work because Ruby doesn't support them, and ruby threads don't work reliably because of unpleasant interactions with the ObjC exception handling mechanism. I made a patch to ruby and rubycocoa a while ago that attempts to work around the latter problem - i.e., it lets you use Ruby threads in a RubyCocoa application. If you're able to recompile both ruby and rubycocoa, you could give it a shot. It's still necessary to make AppKit calls on the main thread (use self.performSelector...), but you can do ruby-level background tasks ok. I've attached the two patches - one to ruby-1.8.2 and one to RubyCocoa. Thanks Jonathan |