• 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: Canceling and then retrying a bunch of tasks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Canceling and then retrying a bunch of tasks


  • Subject: Re: Canceling and then retrying a bunch of tasks
  • From: Rick Mann <email@hidden>
  • Date: Mon, 07 Dec 2015 17:58:06 -0800

> On Dec 7, 2015, at 17:50 , Jens Alfke <email@hidden> wrote:
>
>
>> On Dec 7, 2015, at 5:06 PM, Rick Mann <email@hidden> wrote:
>>
>> I don't see a good way to do this, though. I don't see any way to be sure that all the canceled tasks canceled or completed, because I don't necessarily get a call back to tell me each one is canceled. Any of them could complete just before or just after I cancel (or at the same time).
>
> If you do the work on the operation queue that the delegates are called on, there shouldn’t be race conditions like this — you’re essentially doing it single-threaded just like in the old days of NSURLConnection and runloops. Just cancel all the tasks for which you haven’t yet gotten a completion/failure callback.

Okay, so let's say this happens:

While I'm in the completion block for download A, download B completes (because more than one was issued simultaneously by iOS, as I assume the case can be). In completion block A, I cancel all the downloads and return. Does B call its completion block, or does it short-circuit that?

Also, I presume this only works if the queue is a serial queue, but the docs say it doesn't have to be such.

--
Rick Mann
email@hidden



 _______________________________________________
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: Canceling and then retrying a bunch of tasks
      • From: Jens Alfke <email@hidden>
    • Re: Canceling and then retrying a bunch of tasks
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
    • Re: Canceling and then retrying a bunch of tasks
      • From: Rick Mann <email@hidden>
References: 
 >Canceling and then retrying a bunch of tasks (From: Rick Mann <email@hidden>)
 >Re: Canceling and then retrying a bunch of tasks (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Canceling and then retrying a bunch of tasks
  • Next by Date: Re: Canceling and then retrying a bunch of tasks
  • Previous by thread: Re: Canceling and then retrying a bunch of tasks
  • Next by thread: Re: Canceling and then retrying a bunch of tasks
  • Index(es):
    • Date
    • Thread