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: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Mon, 20 Oct 2014 08:54:12 +0100
On 18 Oct 2014, at 22:09, Daryle Walker <email@hidden> wrote:
> How strict is the requirement that the NSURLProtocolClient methods have to be called from the client thread, since you (generally) don’t control which thread(s) an NSOperationQueue works with?
It's a requirement.
> 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.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
[1] Part of the LinkedImageFetcher sample code.
<https://developer.apple.com/library/mac/#samplecode/LinkedImageFetcher/>
_______________________________________________
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