title: Can I dispatch tasks to the OSX DisplayLink thread using Grand Central Dispatch?
body: <p>In an OpenGL app under OSX, the rendering code typically runs on the DisplayLink thread, which is separate from the Main thread.</p>
  
  <p>When performing tasks in the background, such as loading GL assets, it's important to synchronize the threads, so the rendering thread is not trying to draw from models that are actively being changed by the background thread.</p>
  
  <p>When rendering occurs on the main thread, I've been using GCD to dispatch critical sections of the background tasks to the main dispatch queue like so:</p>
  
  <pre><code>dispatch_async(dispatch_get_main_queue(), ^{ [self doCriticalThing]; });
  </code></pre>
  
  <p>But this doesn't work when rendering occurs on the DisplayLink thread, because, not surprisingly, I get thread conflicts between the main thread trying to run the critical task while the DisplayLink is attempting to render.</p>
  
  <p>Is it possible to use GCD to dispatch tasks to the DisplayLink thread, instead of to the main thread?</p>
  
  <p>Or do I need to revert to using something like:</p>
  
  <pre><code>performSelector:onThread:withObject:waitUntilDone:
  </code></pre>
  
  <p>to directly assign the task to the DisplayLink thread?</p>