• 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: threads vs run-loops for keeping your GUI responsive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: threads vs run-loops for keeping your GUI responsive


  • Subject: Re: threads vs run-loops for keeping your GUI responsive
  • From: "Joshua D. Orr" <email@hidden>
  • Date: Fri, 9 Dec 2005 10:05:33 -0700




On Dec 9, 2005, at 7:44 AM, Niko Matsakis wrote:

Unfortunately, it is not clear to me how I might schedule a call to this event. I have scoured the wiki and mailing list, but I can't find much mention of this approach: everyone seems to want to create worker threads.

I know I could use NSTimer, but again that doesn't feel quite right: I want the function to be called ASAP, assuming that nothing else is going on; scheduling it for a certain time seems overly complicated.

Surely there is a way to do this? Am I missing something? Is this not a good approach?


[[NSRunLoop currentRunLoop] performSelector:@selector(someMethod)
target:sombObject
argument:nil
order:6
modes:[NSArray arrayWithObject:@"NSDefaultRunLoopMode"]];

'order' defines the priority incase there are more then one events to process.

I accutaly used this method in a run loop running in a separate thread (not the main thread) and it worked great. I am sure it would work fine in the main thread.

Anyway, This will tell the run loop to execute the method next time execution reaches the run loop.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: threads vs run-loops for keeping your GUI responsive
      • From: Niko Matsakis <email@hidden>
    • Re: threads vs run-loops for keeping your GUI responsive
      • From: Markus Hitter <email@hidden>
References: 
 >threads vs run-loops for keeping your GUI responsive (From: Niko Matsakis <email@hidden>)

  • Prev by Date: Re: run-time list of selectors in protocol?
  • Next by Date: Re: adding an executable as a resource
  • Previous by thread: Re: threads vs run-loops for keeping your GUI responsive
  • Next by thread: Re: threads vs run-loops for keeping your GUI responsive
  • Index(es):
    • Date
    • Thread