• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What's the best way to run an NSURLProtocol session?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: What's the best way to run an NSURLProtocol session?
      • From: Daryle Walker <email@hidden>
References: 
 >What's the best way to run an NSURLProtocol session? (From: Daryle Walker <email@hidden>)
 >Re: What's the best way to run an NSURLProtocol session? (From: "Quinn \"The Eskimo!\"" <email@hidden>)
 >Re: What's the best way to run an NSURLProtocol session? (From: Daryle Walker <email@hidden>)

  • Prev by Date: Re: What's the best way to run an NSURLProtocol session?
  • Next by Date: Re: What's the best way to run an NSURLProtocol session?
  • Previous by thread: Re: What's the best way to run an NSURLProtocol session?
  • Next by thread: Re: What's the best way to run an NSURLProtocol session?
  • Index(es):
    • Date
    • Thread