On Mon, Feb 1, 2010 at 8:16 AM, slasktrattena...@gmail.com
<slasktrattena...@gmail.com> wrote:
> Quick followup: is it safe to set the token field's object value from
> the background thread, or do I need to do it on the main thread as
> well? Or to put it in more general terms: are _all_ calls to AppKit
> from a background thread disallowed, or only those regarding updating
> the UI?

Threading Programming Guide > Thread Safety Summary > NSView Restrictions:

"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."

You are not drawing, so what you are doing falls under "other operations."

> Also, is it thread-safe to bracket the sizeToFit method between
> lockFocusIfCanDraw and unlockFocus, rather than performing the
> resizing on the main thread?

-sizeToFit is not a drawing method. It's unclear why you think
-lockFocusIfCanDraw will help here.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to