[Rubycocoa-devel 366] Re: Threading thoughts

アーカイブの一覧に戻る

Laurent Sansonetti lsans****@apple*****
Sun Aug 20 19:00:58 JST 2006


Hi Jonathan,

On Aug 20, 2006, at 11:19 AM, Jonathan Paisley wrote:

> Hello,
>
> Since we can't support access from multiple native threads at the  
> moment
> (due to limitations in the ruby interpreter), I wondered if we should
> include a run-time warning to check that the all calls into the bridge
> from objc->ruby are being performed in the same thread?
>
> i.e., call pthread_self() and check that the thread id is the same  
> as the
> first one used. If not, report an error in some way.
>
> Any thoughts?

I totally agree with this, I recently got a crash that was due to some  
ObjC code that was callback'ing a Ruby object in a different thread,  
and this resulted in a Ruby assertion (IIRC inside rb_gc()). We should  
definitely print a message to alert the user.

Also, if you find any Apple-provided frameworks that are messaging  
delegate/datasource methods from different threads, do not hesitate to  
file an Apple bug (https://bugreport.apple.com) and tell me the bug  
number.

Laurent



More information about the Rubycocoa-devel mailing list
アーカイブの一覧に戻る