What about spawning a secondary thread which uses select (or kqueue, which
is pretty easy to use BTW) to block waiting for events, without a timeout.
When select (or kqueue) returns an event(s), then use:

[yourAppDelegateOrControllerOrWhatever performSelectorOnMainThread:
@selector(handleFactorEvent:) withObject: yourCustomEventDescriptorClass
waitUntilDone: NO]

That's the simple version. In my own code, the bg thread actually invokes in
the bg thread a method on my app delegate that creates the event instance
and puts the event on a queue (std::vector<mythingy> with appropriate
locking) before calling performSelectorOnMainThread which will pull events
out of the queue until there are no more. And... I don't rememeber why ;-)

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to