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: Roland King <email@hidden>
- Date: Tue, 12 Nov 2013 23:26:34 +0800
On 12 Nov, 2013, at 10:26 pm, Graham Cox <email@hidden> wrote:
> Is this just one of those cases where you have to judge the best approach, or is there a better way to determine when to pass YES or NO?
>
> Currently, I generally pass NO, and my worker threads are not updating the progress too often anyway - I mod the count so that it only updates every 50 or 100 iterations. The UI seems to keep up fine. What do others do?
The only case I regularly block and wait for a thread is with CoreData where I very often use performBlockAndWait: because I've had some issues threading CoreData and this does give a bit more defined operation. I don't do it from the main thread. Core data I find particularly tricky especially when I have notifications of saves getting tossed around to other queues, so I try to synchronize it more than other subsystems.
For everything else I pass no or use dispatch_async() and attempt to code one subsystem per thread/dispatch_queue/operation queue. If you separate them like that, they tend not to fall over each other and just process as fast as they feel like going. If they do fall over each other, your subsystem was often not as sub- as you thought it was.
_______________________________________________
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