Instance Method

cancelAllOperations()

Cancels all queued and executing operations.

Declaration

func cancelAllOperations()

Discussion

This method calls the cancel() method on all operations currently in the queue.

Canceling the operations does not automatically remove them from the queue or stop those that are currently executing. For operations that are queued and waiting execution, the queue must still attempt to execute the operation before recognizing that it is canceled and moving it to the finished state. For operations that are already executing, the operation object itself must check for cancellation and stop what it is doing so that it can move to the finished state. In both cases, a finished (or canceled) operation is still given a chance to execute its completion block before it is removed from the queue.

See Also

Managing Operations in the Queue

func addOperation(Operation)

Adds the specified operation to the receiver.

func addOperations([Operation], waitUntilFinished: Bool)

Adds the specified operations to the queue.

func addOperation(() -> Void)

Wraps the specified block in an operation and adds it to the receiver.

var operations: [Operation]

The operations currently in the queue.

Deprecated
var operationCount: Int

The number of operations currently in the queue.

Deprecated
func waitUntilAllOperationsAreFinished()

Blocks the current thread until all of the receiver’s queued and executing operations finish executing.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software