| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in Mac OS X v10.6 and later. |
| Companion guide | |
| Declared in | NSOperation.h |
The NSBlockOperation class is a concrete subclass of NSOperation that manages the concurrent execution of one or more blocks. You can use this object to execute several blocks at once without having to create separate operation objects for each. When executing more than one block, the operation itself is considered finished only when all blocks have finished executing.
Blocks added to a block operation are dispatched with default priority to an appropriate work queue. The blocks themselves should not make any assumptions about the configuration of their execution environment.
For more information about blocks, see Blocks Programming Topics.
Creates and returns an NSBlockOperation object and adds the specified block to it.
+ (id)blockOperationWithBlock:(void (^)(void))block
The block to add to the new block operation object’s list. The block should take no parameters and have no return value.
A new block operation object.
NSOperation.hAdds the specified block to the receiver’s list of blocks to perform.
- (void)addExecutionBlock:(void (^)(void))block
The block to add to the receiver’s list. The block should take no parameters and have no return value.
The specified block should not make any assumptions about is execution environment.
Calling this method while the receiver is executing or has already finished causes an NSInvalidArgumentException exception to be thrown.
NSOperation.hReturns an array containing the blocks associated with the receiver.
- (NSArray *)executionBlocks
An array of blocks. The blocks in this array are copies of the ones originally added using the addExecutionBlock: method.
NSOperation.hLast updated: 2009-02-23