On 18 Oct 2014, at 22:09, Daryle Walker <dary...@mac.com> 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      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to