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.
Document Revision History
Date | Notes |
---|---|
2013-08-13 | Updated formatting. |
2003-02-25 | New document that explains the thread-safety issues for the Quartz 2D API. |
Copyright © 2013 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2013-08-13