title: Swift 3.0: Does calling `sync` on a queue after calling `async` block the queue?
body: <p>I was going through the revisions in the <a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html#//apple_ref/doc/uid/TP40014097-CH34-ID545" rel="nofollow">Swift document</a> and found the following</p>
  
  <blockquote>
    <p>If you need to capture and mutate an in-out parameter, use an explicit local copy, such as in multithreaded code that ensures all mutation has finished before the function returns.</p>
  </blockquote>
  
  <pre><code>func multithreadedFunction(queue: DispatchQueue, x: inout Int) {
      // Make a local copy and manually copy it back.
      var localX = x
      defer { x = localX }
  
      // Operate on localX asynchronously, then wait before returning.
      queue.async { someMutatingOperation(&amp;localX) }
      queue.sync {}
  }
  </code></pre>
  
  <p>I had two questions concerning this:</p>
  
  <ol>
  <li>Does calling <code>async</code> and then calling <code>sync</code> block the queue? </li>
  <li>Why would you call <code>async</code> in the first place if you wanted to wait? I always thought asynchronous tasks were to return immediately without waiting until the whole code block was executed. Shouldn't one call <code>sync</code>?</li>
  </ol>
  
  <p><strong>EDIT</strong> Added link to the document. BTW I don't think whether <code>queue</code> is serial or concurrent is not too relevant.</p>