You can't really check to see if you need to cancel the operation if it's in a block. If it's in a block and it's supposed to be canceled then it is canceled. Accessing NSOperation properties is not possible because the block is not an NSOperation instance per se.
Example code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSOperationQueue *q = [[NSOperationQueue alloc] init];
[q addOperationWithBlock:^{
[NSThread sleepForTimeInterval:10];
NSLog(@"Block 1");
}];
[q addOperationWithBlock:^{
[NSThread sleepForTimeInterval:3];
NSLog(@"Block 2");
}];
[q cancelAllOperations];
[NSThread sleepForTimeInterval:15];
[pool drain];
return 0;
}
If you remove the cancelAllOperations call then the blocks fire as you would expect.
I would suggest that if you need to have finer grained control over the operation's cancel state and interplay with the NSOperationQueue that you would be better off using an NSOperation rather than an NSBlockOperation. You can subclass NSOperation to accomplish this.