Re: Aqua animations drawing from separate thread
Re: Aqua animations drawing from separate thread
- Subject: Re: Aqua animations drawing from separate thread
- From: Dave Keck <email@hidden>
- Date: Fri, 14 Aug 2009 15:09:36 -1000
Before your post, I knew that some AppKit drawing was done in
secondary threads, but it never occurred to me that this could cause
one's own NSView subclasses to be drawn in a separate thread, too.
Presumably, if one's custom drawRect: method can be called in a
separate thread due to a pulsing NSButton, there are other scenarios
that can cause non-main-thread drawing, too. Until there are explicit
rules laid out, then indeed, the only safe drawing code is thread-safe
drawing code. Before posting, I noticed this document falsely claims
that 'all drawing ... [is] handled on the main thread:
http://devworld.apple.com/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/UnblockUI.html
Of course, one can perform drawing in a separate thread if they
explicitly write code to do so. But the fact that a simple NSView
subclass's -drawRect: can be called on a separate thread without any
explicit action to do so... eek. I've been writing a lot of unsafe
view code over the years.
I'm sorry I don't have an answer for you, but hopefully someone on the
inside could comment. I'm surprised by this, and at the very least
it's a documentation bug.
David
_______________________________________________
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