Re: Inserting a task into the run loop
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 16:05:56 +1100
> On 23 Mar 2015, at 12:47 pm, Graham Cox <email@hidden> wrote:
>
> But what actual form would a task take that said "loop as many times as necessary until there's no more to do, then finish"?
Just to clarify, as re-reading this it isn't clear what I really mean:
I mean a task that will loop on each turn of the run loop until done, then finish. Seems to me there isn't really anything that quite fits that - an NSOperation fires once, so I'd need to keep creating these and rescheduling them. Maybe that's OK, performance wise? Alternatively a timer can be made to fire once per run loop, but never stops. Maybe a thread with a lock really is the best approach here, especially as it punts the simulation on to a second processor so it can run as fast as possible as long as it needs to. The hassle there is messaging the main thread for UI updates and all the usual multi-threaded gotchas.
I've had lots of helpful suggestions (thanks!), but the best way forward is still not that obvious.
--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