Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Not thread safe events?




On Oct 19, 2005, at 10:00 AM, Scott Fraser wrote:

You can create your own event types, and post them directly to the Carbon Event queue of the secondary thread. You can install handlers on the event dispatcher for that thread, using GetEventDispatcherTarget to get the event target for that thread. Then in the secondary thread, ReceiveNextEvent, and then SendEventToEventTarget. Maybe that's a little roundabout, but it works.

Actually, this isn't quite right; there is only one event dispatcher target, and it only applies to the main thread. There is no event dispatcher target for a secondary thread.


Generally, the way apps use events posted to secondary threads would be by calling ReceiveNextEvent on that thread's event queue, and after the event is returned, just unpacking it and handling it right there in the loop, without sending it to any further event target.

-eric

_______________________________________________
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
References: 
 >Re: Not thread safe events? (From: Mike Kluev <email@hidden>)
 >Re: Not thread safe events? (From: Scott Fraser <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.