Kodeco Forums

Video Tutorial: Introducing Concurrency Part 2: NSOperationQueue

Learn how to use NSOperationQueue to handle the scheduling and execution of NSOperations.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4034-introducing-concurrency/lessons/3

I think we also need to wait for the addQueue to finished, or sometimes we may get wrong filteredImages array, because the addQueue is still running.

Quick question. Does the completion block only run once that particular NSOperation is Finished? Is that why we add the appendQueue.addOperationWithBlock inside of the completion block. So that once the NSOperation is completed proceed appending that image into the array using a serial queue

That’s exactly correct, yes. The completion block is called once the operation has completed, and then the serial queue is used to ensure the thread safety of the array access. :slight_smile:

sam

1 Like