title: What is purpose of dispatch sync?
body: <p>I'm pretty clear what dispatch_async queue is performing, but I'm not clear what dispatch_sync purpose is. For an example: what is difference between this: <br></p>
  
  <pre><code>NSLog(@"A");
  NSLog(@"B");
  </code></pre>
  
  <p>and this:<br></p>
  
  <pre><code>dispatch_sync(dispatch_get_main_queue(), ^ {
  NSLog(@"A");
      });
  NSLog(@"B");
  </code></pre>
  
  <p>As I get, in both ways output will be A then B. Because sync is executed in order that is written. Thanks.</p>