title: Waiting until two async blocks are executed before starting another block
body: <p>When using GCD, we want to wait until two async blocks are executed and done before moving on to the next steps of execution. What is the best way to do that?</p>
  
  <p>We tried the following, but it doesn't seem to work:</p>
  
  <pre><code>dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
      // block1
  });
  
  
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
      // block2
  });
  
  // wait until both the block1 and block2 are done before start block3
  // how to do that?
  
  dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
      // block3
  });
  </code></pre>