I have this code:

NSMethodSignature *ms = [ self methodSignatureForSelector: 
@selector(someMethod:) ];
NSInvocation *inv = [NSInvocation invocationWithMethodSignature: ms ];
[ inv retainArguments ];
[ inv setSelector: @selector(someMethod:) ];
[ inv setTarget: self ];
[ inv setArgument: &a atIndex: 2 ];

NSInvocationOperation *ivo = [ [ NSInvocationOperation alloc ] 
initWithInvocation: inv ];
[ self.operationQueue  addOperation: ivo ];

Works fine. But the documentation says: "An operation object is responsible for 
calling [isCanceled] periodically and stopping itself if the method returns 
YES."

But how do I check for "isCanceled" from within someMethod: ?

Is there something like: +[ NSOperation theOperationThisCodeIsRunningIn ]?

I tried (inside of someMethod:):
NSThread *currentThread = [ NSThread currentThread ];
if ( [ currentThread isCancelled ] ) NSLog(@"%s Cancelled",__FUNCTION__);

But this has no effect.
10.7.3


Kind regards,

Gerriet.

                
        
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to