on 1/27/05 3:35 AM, Mike Kluev at <email@hidden> wrote:
> On Wed, 26 Jan 2005 09:26:42, George Warner <email@hidden> wrote:
>
>> On Tue, 25 Jan 2005 20:40:38 -0800, Eric Schlegel <email@hidden> wrote:
>>> I think the primary issues would be:
>>> - don't share a CGContext across threads; I don't believe Quartz
>>> synchronizes context access. Use a separate context for each thread.
>>
>> Actually, you can do this. As long as the area's being drawn to by the
>> different thread don't overlap then Quartz can handle the same context being
>> used my multiple threads. Internally it serializes accesses to the context.
>
> George, I am curious if such internal serialization is really needed
> if areas being drawn don't overlap.
>
> Mike
Absolutely. One thread could call:
CGContextScaleCTM(context, 1.0f, -1.0f);
And the other:
CGContextScaleCTM(context, 3.0f, 1.0f);
If they're both using the same context then which ever one executes last
will effect drawing in the other thread. Something isn't going to look
right.
Note however that the internal serialization doesn't prevent messed up
drawing in that other thread. But it does prevent crashes caused by
non-reentrant code.
Assuming that both threads are using the same Scale, transform, etc. then
one thread drawing a square and another a circle should still work as
expected. At the API level all operations can be assumed to be atomic.
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden