Re: What's the best way to run an NSURLProtocol session?
Re: What's the best way to run an NSURLProtocol session?
- Subject: Re: What's the best way to run an NSURLProtocol session?
- From: Daryle Walker <email@hidden>
- Date: Mon, 20 Oct 2014 18:47:44 -0400
On Oct 20, 2014, at 3:54 AM, Quinn The Eskimo! <email@hidden> wrote:
> On 18 Oct 2014, at 22:09, Daryle Walker <email@hidden> wrote:
>
>> Or can the threading NSOperationQueue uses be controlled in a way compatible with NSURLProtocolClient?
>
> That depends on how you implement your NSOperations. A concurrent NSOperation has good control over its threading (for example, QHTTPOperation > QRunLoopOperation [1]). A standard operation has to run on the thread that's allocated to it by the queue.
>
> Again, this all comes back to you underlying asynchrony. If that's run loop based, it's a good match for NSURLProtocol. For example, if you want to transport requests over NSStream, you could easily create an NSOperation based on QRunLoopOperation and there would be very little impedance mismatch. The situation with other APIs depends on the API.
>
> [1] Part of the LinkedImageFetcher sample code.
>
> <https://developer.apple.com/library/mac/#samplecode/LinkedImageFetcher/>
Over the weekend, I read the Programming Guide corresponding to NSThread. I just used one of the -performSelector: APIs. Easier than I anticipated, except for the fact the code isn’t working right now. (That’s on the general Cocoa list. Should I ask here too?)
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden