Re: drawing thread-safety in iOS
Re: drawing thread-safety in iOS
- Subject: Re: drawing thread-safety in iOS
- From: David Duncan <email@hidden>
- Date: Thu, 2 Dec 2010 11:23:10 -0800
UIKit graphics drawing methods are thread safe on iOS 4.0 or greater. If you are referring to the QA on using a CATiledLayer with UIView, that probably does indeed need to be updated, but the methods it warns against should all be safe to use from secondary threads on iOS 4.0 or later.
On Dec 2, 2010, at 10:45 AM, Matt Neuburg wrote:
> I'm having trouble getting a handle on what's thread-safe in iOS drawing and what's not. The trouble is that the docs are so coy (and out-of-date, as far as I can tell). To the extent that the docs do say anything clear, it's all negative:
>
> "You cannot use any UIKit's drawing methods when drawing to a CATiledLayer, and you cannot do your drawing inside of a UIView's -drawRect: method. Instead you must implement -drawLayer:inContext: and draw only using Core Graphics and other thread-safe functions that accept a CGContextRef to target drawing to."
>
> "UIGraphicsBeginImageContext... You should call this function from the main thread of your application only."
>
> And so forth. However, in an obscure corner of the release notes, we read (for iOS 4):
>
>> • Drawing to a graphics context in UIKit is now thread-safe. Specifically:
>> • The routines used to access and manipulate the graphics context can now correctly handle contexts residing on different threads.
>> • String and image drawing is now thread-safe.
>> • Using color and font objects in multiple threads is now safe to do.
>
> Moreover, in the WWDC videos we see CATiledLayer being drawn to via drawRect: with UIKit.
>
> So what's true? And how can I find out precisely what is and isn't thread-safe? m.
--
David Duncan
_______________________________________________
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