• 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: Inserting a task into the run loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting a task into the run loop


  • Subject: Re: Inserting a task into the run loop
  • From: Graham Cox <email@hidden>
  • Date: Mon, 23 Mar 2015 09:23:57 +1100

> On 22 Mar 2015, at 4:21 pm, Kyle Sluder <email@hidden> wrote:
>
> Use a run loop observer?


OK, that looks relevant. I didn't see the term in NSRunLoop so....

But looking at the docs, I wonder if this is really what I want. If nothing is going on, won't my run loop simply go to sleep? That means I'm only going to get called once per run loop if there are other events happening. On reflection, I don't think that's going to work for me here. I need my code to run all the time. It's not heavyweight processing, so it isn't going to be a huge drain on anything, but it does need to have frequent calls. My timer approach does keep the run loop awake, but it feels a bit off to be using a timer for something that isn't truly a time-related task, only a task that needs to run "as often as possible".

My code can also run as a separate thread, and when it does so, it's just an endless loop. That's fine, except that at a higher level it's driving or updating a UI, so it has to go to a lot of trouble to ensure all those updates are pushed onto the main thread. In practice it's just easier to run all the code on the main thread synchronously.

--Graham



_______________________________________________

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: Inserting a task into the run loop
      • From: Ken Thomases <email@hidden>
References: 
 >Inserting a task into the run loop (From: Graham Cox <email@hidden>)
 >Re: Inserting a task into the run loop (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Memory optimization of NSAttributedString
  • Next by Date: Re: Inserting a task into the run loop
  • Previous by thread: Re: Inserting a task into the run loop
  • Next by thread: Re: Inserting a task into the run loop
  • Index(es):
    • Date
    • Thread