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 Tue, 18 Oct 2005 14:55:45, Scott Fraser <email@hidden> wrote:

> On Oct 18, 2005, at 12:02 PM, George Warner wrote:
> 
>> You can post events from a secondary thread but currently that's about
>> it.
>> 
>> All handler should run on the main thread.
> 
> Surely you meant that all handlers for "UI events" should run on the
> main thread.  Otherwise it wouldn't make any sense to be able to post
> an event to the event queue of a secondary thread.

Hmm, maybe it doesn't currently make any sense? How'd you obtain
event target of a "non UI element" (whatever this means) to be
able to InstallEventHandler on it? Ok, probably by calling
HIObjectGetEventTarget on some ad hoc hi object created for the
purpose of having the required EventTargetRef (HIObjectCreate,
HIObjectGetEventTarget and InstallEventHandler will have to be
called on the main thread - because they are not thread safe -
but that's doable). But then, in order to call your event handler
on the secondary thread, you or the system will have to use
SendEventToEventTarget in the secondary thread and
SendEventToEventTarget is not thread safe. Even ReceiveNextEvent
is not thread safe to receive events manually without dispatching
them to handlers. Makes me wonder what is the purpose of per-thread
event queuesthen at all... Or is this just another instance that
by "not thread safe" they don't mean "not safe to call on secondary
threads" but something different like "don't call from more than
one thread on the same eventRef"?

Mike

 _______________________________________________
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



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.