title: Grand Central Dispatch (GCD) with CoreData
body: <p>I'm using Grand Central Dispatch (GCD) in my application to do some heavy lifting. The application is using Core-Data for data storage purposes. Here's my scenario (along with relevant question):</p>
  
  <pre><code>dispatch_queue_t main_queue = dispatch_get_main_queue();
  dispatch_queue_t request_queue = dispatch_queue_create("com.app.request", NULL);
  
  dispatch_async(request_queue, ^{
      MyNSManagedObject *mObject = [self.fetchedResultsController objectAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
  
      // … 
      // &lt;heavy lifting&gt;
      // … 
  
      // … 
      // &lt;update mObject&gt;
      // … 
  
      [self saveManagedObjectContext];
  });     
  </code></pre>
  
  <p>As a result of <code>[self saveManagedObjectContext]</code>, <code>fetchResultsController</code> delegate methods are called automatically. Consequently, the UI updation logic kicks.</p>
  
  <p>Now my question is, do I need to use <code>main_queue</code> for <code>-saveManagedObjectContext</code>? Should I perform all operations on my <code>NSManagedObject</code> in <code>main_queue</code>? Some of the operations that update the <code>NSManagedObject</code> might take 2-3 seconds. Please advise.</p>