On Apr 3, 2010, at 5:16 PM, Pat Wilson wrote:

> When an event tap is created using CGEventTapCreate, which process, or thread 
> actually runs the callback function? The one which created the tap, the first 
> responder, ...?

The first responder isn't a thread, process, or runtime/execution context.  
That aspect of your question doesn't make any sense, just so you know.

The documentation for CGEventTapCreate says:

> Your callback function is invoked from the run loop to which the event tap is 
> added as a source. The thread safety of the callback is defined by the run 
> loop’s environment.

Since a run loop is directly associated to a thread, you control which thread 
the callback is called on.  If you add the run loop source for the returned 
Core Foundation mach port to the current run loop, then the callback will be 
called on the current thread.  If you add it to the main run loop, then it will 
be called on the main thread.  Etc.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to