In what cases would you prefer to use NSOperationQueue
or NSOperation
or GCD.
I have just started working in thread so what are the benefits and time complexity.
When we need to use which one and what are the benefits and in which cases we need to consider which one .
GCD is low level C-based API.
NSOperation
and NSOperationQueue
are Objective-C classes that are based on GCD and simplify execution prioritisation and cancellation.
Advantages of NSOperationQueue
over GCD include:
It is easy to cancel or suspend an operation if it is in queue it can be stopped if it is running.
You can define the maximum number of concurrent operations.
You can make dependencies between distinct instances of NSOperation
.