title: Two simultaneous background tasks using NSOperationQueue
body: <p>I have two tasks that i need to perform in background simultaneously with different thread priorities:</p>
  
  <ol>
  <li><p>continuously gather and process gyro motion data (high priority)</p>
  
  <pre><code>gyroQueue = [[NSOperationQueue alloc] init];
  
  [self.motionManager startDeviceMotionUpdatesToQueue:gyroQueue withHandler:^(CMDeviceMotion *motion, NSError *error){
      [self processMotion:motion withError:error];
  }];
  </code></pre></li>
  <li><p>Sometimes process images without interfering with motion updates (convert, crop, sesize, etc = 1-2sec) (very low priority)</p>
  
  <pre><code>imageProcessingQueue = [[NSOperationQueue alloc] init];
  
  [imageProcessingQueue addOperationWithBlock:^{
      [self processImage:[UIImage imageWithData:imageData]];
  }];
  </code></pre></li>
  </ol>
  
  <p>EDIT:   this is what I had in place originally (instead of block operation), and it is still blocking the motion updates:</p>
  
  <pre><code>NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(processImage:) object:[UIImage imageWithData:imageData]];
  [operation setThreadPriority:0.0];
  [operation setQueuePriority:0.0];
  [imageProcessingQueue addOperation:operation];
  </code></pre>
  
  <p>It seems as both of these tasks are being executed on the same background thread (due to NSOperationQueue nature?), and processing of an image blocks the gyroQueue updates until it's done, which is what i am trying to avoid.</p>
  
  <p>How can I spawn two separate threads using NSOperationQueue, and assign veryHigh &amp; veryLow priorities accordingly?</p>
  
  <p>EDIT: this question is still open, i am using Travor Harmon's image resize functions for image resize. Can someone confirm if it's thread safe?</p>