• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to create secondary Thread that listens to event taps?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How to create secondary Thread that listens to event taps?
      • From: Rainer Brockerhoff <email@hidden>
  • Prev by Date: Re: Heapshot Analysis to find Memory Accretion (Leaks)
  • Next by Date: MutableArray and TableView Question
  • Previous by thread: Re: How to create secondary Thread that listens to event taps?
  • Next by thread: Re: How to create secondary Thread that listens to event taps?
  • Index(es):
    • Date
    • Thread