Re: NSOutlineView threading problem
Re: NSOutlineView threading problem
- Subject: Re: NSOutlineView threading problem
- From: David <email@hidden>
- Date: Mon, 16 Jun 2008 10:44:02 -0400
On Sun, Jun 15, 2008 at 12:03 AM, Jens Alfke <email@hidden> wrote
>
> I don't think that's safe. I have seen no assurances that NSOutlineView is
> thread-safe, and in general most AppKit control classes should _not_ be
> accessed from background threads.
>
While I've been investigating this, I have found more documentation on
thread safety issues in the "Threading Programming Guide". I'd read it
before but it helps to re-read. It says that NSView classes ARE thread
safe... to an extent.
NSView
The NSView class is generally thread-safe, with a few exceptions. You should
create, destroy, resize, move, and perform other operations on NSView objects
only from the main thread of an application. Drawing from secondary threads
is thread-safe as long as you bracket drawing calls with calls to
lockFocusIfCanDraw and unlockFocus.
If a secondary thread of an application wants to cause portions of the view
to be redrawn on the main thread, it must not do so using methods like
display, setNeedsDisplay:, setNeedsDisplayInRect:, or setViewsNeedDisplay:.
Instead, it should send a message to the main thread or call those methods
using the performSelectorOnMainThread: method instead.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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