ADC Home > Reference Library > Technical Q&As > Graphics & Imaging > Quartz >

Quartz 2D Thread Safety


Q: Is Quartz 2D thread safe?

A: Quartz is thread safe on the whole, but individual Quartz objects are not. In general, you can operate on any object on any thread as long as you guarantee that no two threads are operating on the same object simultaneously. The easiest way to achieve this is to not share your objects between threads.

There are several additional things you need to watch out for:

  • If you have multiple CGContextRefs drawing to the same window or bitmap context and the content of those CGContextRefs overlaps, then you will get undefined behavior.
  • In the case of multiple CGPDFContextRefs, trying to draw to different CGPDFContextRefs that point to the same CGDataConsumerRef doesn't make sense.

[Feb 25 2003]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.