Should you ever run operation queues on a dispatch queue?

I was watching a video at raywenderlich.com (https://www.raywenderlich.com/3648-ios-concurrency-with-gcd-and-operations/lessons/6) and the narrator (Audrey Tam) says (verbatim), about OperationQueue management, at the 2:57 (2 minutes 57 seconds) mark:


"If you want to do something when all the operations have finished, set up a private serial dispatch queue, where you can call the operation queues, wait until all operations are finished".


I'm wondering if she used the wrong words for the wrong things or misspeak. Does what she said make sense? Should you ever run operation queues on a dispatch queue? Even if she meant to say "operations" instead of "operation queues", it seems counter-intuitive to use operations on a dispatch queue.


Can someone help me out here. It will be appreciated.

Accepted Reply

I don't see anything contradictory here. (I don't know what "call the operation queues" means, but maybe the word wasn't "call"? The video is behind a paywall, so I can't double-check.)


In the described scenario, none of the operations are running on the private serial dispatch queue. What (presumably) runs on the dispatch queue are one or more closures which invoke "OperationQueue.waitUntilAllOperationsAreFinished()".


In other words, the serial dispatch queue isn't for serializing the operations, it's for serializing the wait for operations to be done.

Replies

I don't see anything contradictory here. (I don't know what "call the operation queues" means, but maybe the word wasn't "call"? The video is behind a paywall, so I can't double-check.)


In the described scenario, none of the operations are running on the private serial dispatch queue. What (presumably) runs on the dispatch queue are one or more closures which invoke "OperationQueue.waitUntilAllOperationsAreFinished()".


In other words, the serial dispatch queue isn't for serializing the operations, it's for serializing the wait for operations to be done.

Ok. That makes sense. Thanks.