Re: call scrollRangeToVisible in multi-threads cause application dead lock
Re: call scrollRangeToVisible in multi-threads cause application dead lock
- Subject: Re: call scrollRangeToVisible in multi-threads cause application dead lock
- From: 王 庆 <email@hidden>
- Date: Thu, 8 Mar 2007 23:53:50 +0800
Thanks to all your guy's answer, I think I can find out the best way
for my problem now. Using performSelectorOnMainThread selector is a
good way.
Thanks
Frank
在 2007-3-8,上午1:42,Shawn Erickson 写道:
On 3/7/07, David Gish <email@hidden> wrote:
> Apple states that the AppKit is generally NOT thread safe. Why on
> earth would you think that having critical section in YOUR code
> would magically make the AppKit thread safe. Until or unless Apple
> makes the AppKit thread safe, you are out of luck and there is no
> way you can correctly call AppKit methods directly from multiple-
> threads.
It is certainly possible to call non-thread safe code in a threaded
environment with critical sections in your code.
Only if all parties involved participate in the same critical section
constructs... which in this case he has the system pumping events,
etc. into a runloop in the main thread and none of that code knows
anything about his critical sections.
For example, the C++ STL (Standard Template Library) isn't
thread-safe, but as long as you know that, you prevent simultaneous
access to STL objects in YOUR code.
Right but his ("your") code isn't the only thing involved here...
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Thanks
Frank
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden