Re: NSOperationQueue: -waitUntilAllOperationsAreFinished and -setSuspended:
Re: NSOperationQueue: -waitUntilAllOperationsAreFinished and -setSuspended:
- Subject: Re: NSOperationQueue: -waitUntilAllOperationsAreFinished and -setSuspended:
- From: Kyle Sluder <email@hidden>
- Date: Sat, 01 Oct 2011 16:41:57 -0700
On Sat, Oct 1, 2011 at 3:44 PM, Quincey Morris
<email@hidden> wrote:
>
> Aren't you missing a [replyQueue setSuspended: NO] in there somewhere? And
> if you do that, aren't you then failing to wait for backgroundQueue to
> empty?
Yes, sorry. The call to -setSuspended: happens right before
-waitUntilAllOperationsAreFinished.
[replyQueue setSuspended:NO];
[replyQueue waitUntilAllOperationsAreFinished];
(Obviously this code isn't copy/pasted from my actual source; it's
intended to illustrate the pattern. My actual source has the exact
same structure as what I posted, but the specifics of the operations
aren't relevant here.)
On Sat, Oct 1, 2011 at 3:52 PM, Stevo Brock <email@hidden> wrote:
> What about removing replyQueue altogether, have the background operation add it's result processing back into backgroundQueue and just wait on backgroundQueue to finish?
Other threads may also be adding operations to backgroundQueue.
backgroundQueue is used to serialize my activity (in this example,
tallying up totalResult) with other activities. The caller expects
this method to be synchronous. That design, however, can be changed.
--Kyle Sluder
_______________________________________________
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