Re: waitUntilDone: parameter when performing selector on main thread
Re: waitUntilDone: parameter when performing selector on main thread
- Subject: Re: waitUntilDone: parameter when performing selector on main thread
- From: Graham Cox <email@hidden>
- Date: Tue, 12 Nov 2013 20:23:01 +0100
On 12 Nov 2013, at 8:00 pm, Quincey Morris <email@hidden> wrote:
> Perhaps the question is why you’re using ‘performSelector’ for this at all, other than historical inertia.
Hmm, that just about sums it up I suppose.
> Now, it would be more natural to use GCD for this — dispatch a block onto the main queue
While I can see the power and elegance of blocks, there’s something about them that means they’re still not my go-to solution as much as they should be. Probably the fact that every single time I need to use one I have to go back to the fundamental documentation to figure out the syntax; they just don’t come naturally.
> This is one of those things that’s almost harder to describe in words than it is to do in code.
Probably true, but something Jens said got me thinking, and in fact I have added a solution that’s so easy I dunno why it didn’t occur to me before - instead of the worker thread driving progress, get the progress to poll the worker thread. Turns out that this is so simple my worker thread is doing far, far less than it was to support progress, and the UI cannot go any faster than a rate I set, and nothing is queued at all. Simples! (and thanks Jens for the inspiration).
—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