title: drawViewHierarchyInRect on background thread
body: <p>I'm trying to do some 'offscreen rendering' on a background thread to update a preview of a designer-like app I'm creating. </p>
  
  <p>I've used <code>renderInContext</code> on an NSOperationQueue-derived queue to accomplish this but note it's slow.</p>
  
  <p>So, I've started using <code>drawViewHierarchyInRect</code> which works great and is much faster. However, I've noticed that my UI completely blocks when this method is run in the b/g.</p>
  
  <p>If I do this on the main thread...</p>
  
  <pre><code>    UIView *preview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
      preview.backgroundColor = [UIColor redColor];
  
      UIGraphicsBeginImageContextWithOptions(preview.bounds.size, NO, 0.0);
  
      BOOL ok = [preview drawViewHierarchyInRect:preview.bounds afterScreenUpdates:YES];
  
      UIImage *img = nil;
  
      if( ok )
      {
          img = UIGraphicsGetImageFromCurrentImageContext();
      }
  
      UIGraphicsEndImageContext();
  </code></pre>
  
  <p>...it all works OK.</p>
  
  <p>However, if I (say) dispatch this...</p>
  
  <pre><code>if (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW) == 0) 
  {
      dispatch_async(renderQueue, ^{
          // capture
          UIView *preview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
          preview.backgroundColor = [UIColor redColor];
  
          UIGraphicsBeginImageContextWithOptions(preview.bounds.size, NO, 0.0);
  
          BOOL ok = [preview drawViewHierarchyInRect:preview.bounds afterScreenUpdates:YES];
  
          UIImage *img = nil;
  
          if( ok )
          {
              img = UIGraphicsGetImageFromCurrentImageContext();
          }
  
          UIGraphicsEndImageContext();
  }
          dispatch_semaphore_signal(semaphore);
      });
  </code></pre>
  
  <p>...my UI freezes, totally after execution.</p>
  
  <p>'ok' is returning YES, so all seems to be working.</p>
  
  <p>If I set afterUpdates to NO, 'ok' is NO (failed), but the UI continues to be responsive.</p>
  
  <p>Are there any limits on using drawViewHierarchyInRect an anything other than the main thread?</p>