• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
drawing thread-safety in iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

drawing thread-safety in iOS


  • Subject: drawing thread-safety in iOS
  • From: Matt Neuburg <email@hidden>
  • Date: Thu, 2 Dec 2010 10:45:37 -0800

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.

--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings_______________________________________________

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

  • Follow-Ups:
    • Re: drawing thread-safety in iOS
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: Works in 4.1 but not 4.2 ...
  • Next by Date: Re: Clickable URL in NSPanel
  • Previous by thread: iOS: Rolodex Example?
  • Next by thread: Re: drawing thread-safety in iOS
  • Index(es):
    • Date
    • Thread