0

I have a long running operation with a bunch of "_isCancelled" flags

// long running code
if (_isCancelled)
  return;

// more code
if (_isCancelled)
  return;

// more code

if (_isCancelled)
  return;

// etc.

but it would be much cleaner and easier to add more "long running code" if I could somehow abort the operation from an "outside" listening thread

for instance

-(void)longRunningAsyncOperation
{
  @try {
   // long running operation
  } @catch
  {
   // if aborted just return
  }
}

-(void)cancelOperation
{
// raise an exception on a "listening" thread
}

Any thoughts on this approach? is it possible?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.