Re: How to create secondary Thread that listens to event taps?
Re: How to create secondary Thread that listens to event taps?
- Subject: Re: How to create secondary Thread that listens to event taps?
- From: eveningnick eveningnick <email@hidden>
- Date: Tue, 19 Oct 2010 21:11:07 +0300
> You create the secondary thread, install the event tap in it as usual - that is, create a run loop source for the tap and add the source to the current run loop returned by CFRunLoopGetCurrent() - and then, erhm, run the run loop in a loop :-)
>
> Something like (warning: typed in Eudora):
> while (someCondition) {
> NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
> SInt32 result = CFRunLoopRunInMode(kCFRunLoopDefaultMode,0.5,YES);
> [pool drain];
> if (result==kCFRunLoopRunStopped)) {
> return;
> }
> }
> should work.
>
> HTH,
> --
Hello Rainer
Thanks for the tip
Why did you give 0.5 as the second param of CFRunLoopRunInMode? Is it
the optimal value?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden