[Rubycocoa-devel 1061] Re: Ruby Thread with RubyCocoa

Back to archive index

Satoshi Nakagawa snaka****@infot*****
Wed Jul 4 00:41:25 JST 2007


Hi Laurent.

> This threading support is new and I'm still working on it.
>
> This exception is to warn users that using Ruby threads with RubyCocoa  
> code inside (calls to ObjC) will crash if the Ruby interpreter has not  
> been patched. Maybe this should just be a warning and not an  
> exception, since you could potentially just do pure Ruby stuff inside  
> the threads.

Hmm.
I agreed the point, this should be a warning.

I have another question.
Is calling performSelectorOnMainThread_withObject_waitUntilDone
safe within a Ruby thread now without the patch?

> Using performSelectorOnMainThread_withObject_waitUntilDone with  
> RubyCocoa is a bit useless because RubyCocoa will always use one  
> thread (because Ruby is not thread safe). If you detach a new NSThread  
> from RubyCocoa, RubyCocoa will forward all calls to the main thread  
> indirectly.

Oh really?
That seems indeed good abstraction.

--
Satoshi Nakagawa


On 2007/07/03, at 23:12, Laurent Sansonetti wrote:

> This threading support is new and I'm still working on it.
>
> This exception is to warn users that using Ruby threads with RubyCocoa  
> code inside (calls to ObjC) will crash if the Ruby interpreter has not  
> been patched. Maybe this should just be a warning and not an  
> exception, since you could potentially just do pure Ruby stuff inside  
> the threads.
>
> Using performSelectorOnMainThread_withObject_waitUntilDone with  
> RubyCocoa is a bit useless because RubyCocoa will always use one  
> thread (because Ruby is not thread safe). If you detach a new NSThread  
> from RubyCocoa, RubyCocoa will forward all calls to the main thread  
> indirectly.
>
> Laurent
>
> On Jul 3, 2007, at 3:59 PM, Satoshi Nakagawa wrote:
>
>> Hi.
>>
>> I saw an error message, when I use Ruby threads on trunk, Tiger.
>>
>>  RuntimeError: Ruby threads cannot be used in RubyCocoa without  
>> patches to the Ruby
>>
>> Could you allow me to use Ruby threads on the default ruby  
>> interpreter 1.8.2 of Tiger?
>>
>> In my application, I use  
>> performSelectorOnMainThread_withObject_waitUntilDone
>> to communicate with the main thread from the other threads.
>> I think it's a common manner in writing GUI applications.
>> It works good even on ruby 1.8.2 of Tiger.
>>
>> I want to distribute my software to people using Tiger and the  
>> default ruby 1.8.2.
>> Could you enable the threading patch only if the default interpreter
>> on the system supports the patch?
>>
>> --
>> Satoshi Nakagawa




More information about the Rubycocoa-devel mailing list
Back to archive index