> On 22 Mar 2015, at 4:21 pm, Kyle Sluder <k...@ksluder.com> 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 (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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to