I'm wondering if it's possible to make operations within a NSOperationQueue
only concurrent with certain others. For example:
Which could form a queue as below:
B B
A - | - B - B - | - A
C C
Is such specific concurrency conditions possible with NSOperationQueue
?
The concurrent
property of NSOperation
is misleading in that it rather specifies rather the operation executes its task asynchronously (and in fact is now ignored since 10.6).
This seems to be a good situation for the use of dependencies. With maxConcurrentOperations = 2
the last operation in the queue can be checked before adding another.
If A, make new operation dependent on that if the new operation is either A, B or C.
If B, make new operation dependent on that if the new operation is either B or A.
If C, make new operation dependent on that if the new operation is either C or A.