title: Why is NSOperation::completionBlock called too soon?
body: <p>I have a very simple asynchronous operation</p>
  
  <pre><code>@interface IDBWebpValidationOperation()
  
  @property BOOL executing;
  @property BOOL finished;
  
  @end
  
  @implementation IDBWebpValidationOperation
  
  @synthesize executing;
  @synthesize finished;
  
  - (instancetype)init
  {
  self = [super init];
  if (self) {
      self.completionBlock = ^{
          NSDLog(@"webp validation has finished");
      };
  }
  return self;
  }
  
  - (void)main
  {
  IDBAssert0(self.bestCapture.webpCandidate);
  
  self.finished = NO;
  if(self.postProcessingValidator) {
      self.executing = YES;
      // this starts async operation, see callback below
      self.postProcessingValidator(self.bestCapture.webpCandidate);
  }else{
      IDBAssert0(0);
      //      self.bestCapture.jpegNSData = self.bestCapture.webpCandidate;
      IDBAssert0(self.bestCapture.jpegNSData);
      self.executing = NO;
      self.finished = YES;
  }
  }
  
  - (void)scanningViewController:    (UIViewController&lt;PPScanningViewController&gt;*)scanningViewController
            didOutputResults:(NSArray*)results
  {
  if([results count]&gt;0) {
      self.bestCapture.jpegNSData = self.bestCapture.webpCandidate;
      IDBAssert0(self.bestCapture.jpegNSData);
  }else{
      IDBAssert0(self.microblinkFailureHandler);
      self.microblinkFailureHandler();
  }
  IDBAssert0(!self.finished);
  self.executing = NO;
  self.finished = YES;
  }
  
  -(BOOL)isAsynchronous
  {
  return YES;    //Default is NO so overriding it to return YES;
  }
  </code></pre>
  
  <p>Here I have synthesized two atomic properties executing &amp; finished
  to avoid lots of (in my opinion dumb &amp; extraneous) code swift would force you to do for KVO and the synthesided atomic properties would get me out of the box
  (I think).</p>
  
  <p>The issue is completionBlock is called before scanningViewController:
  callback is invoked. Why?????</p>
  
  <p>This is on ios 9.3.x in case this matters</p>