Re: How to perform delayed calls using NSOperationQueue?
Re: How to perform delayed calls using NSOperationQueue?
- Subject: Re: How to perform delayed calls using NSOperationQueue?
- From: Cody Garvin <email@hidden>
- Date: Mon, 21 Jul 2014 17:54:22 -0700
I know it’s not NSOperationQueue but GCD has dispatch_after.
I ended up writing a queue manager that took NSOperations along with times, preflight block check and postflight block (setting other things up, massaging, etc).
I don’t thinkw NSOperationQueue has an equivalent. Could be wrong
- Cody
> On Jul 21, 2014, at 5:42 PM, Jens Alfke <email@hidden> wrote:
>
> I’m starting to port a pretty complex source base from using NSURLConnection to using NSURLSession. (Primarily because this is the only way to get around the only-four-sockets-per-host limitation.) I thought it was going to be straightforward, until I saw that NSURLSession only supports scheduling delegate calls on an NSOperationQueue, not an NSRunLoop. So that means I now also have to convert a number of runloop dependencies in the same code, which I don’t understand how to do.
>
> Case in point: I have a couple of things that require the use of delayed performs to schedule timing. What’s the equivalent of -performSelector:withObject:afterDelay: (or of NSTimer) for code that’s running under the control of an NSOperationQueue? I know this call won’t work on a queue (because the thread it’s on probably won’t have a runloop), but I’ve looked at the API docs and headers and don’t see anything comparable. Dispatch queues have dispatch_after, and I’d much rather use GCD than NSOperationQueue anyway*, but NSURLSession is forcing my hand.
>
> —Jens
>
> * (I know there’s now an underlyingQueue property on NSOperationQueue, but that’s only in iOS 8 and I can’t rely on that yet.)
> _______________________________________________
>
> 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
_______________________________________________
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