title: Concurrent Queue Issue - iOS/Swift
body: <p>In my program I need two tasks to run simultaneously in the background. To do that i have used concurrent queues as below, </p>
  
  <pre><code>let concurrentQueue = DispatchQueue(label: "concurrentQueue", qos: .utility, attributes: .concurrent)
  
  concurrentQueue.async {
      for i in 0 ..&lt; 10{
          print(i)
      }
  }
  
  concurrentQueue.async {
      for i in (0 ..&lt; 10).reversed(){
          print(i)
      }
  }
  </code></pre>
  
  <p><strong>Here I need the output like this,</strong></p>
  
  <p>0 <br/>
  9 <br/>
  1 <br/>
  8 <br/>
  2 <br/>
  7 <br/>
  3 <br/>
  6 <br/>
  4 <br/>
  5 <br/>
  5 <br/>
  4 <br/>
  6 <br/>
  3 <br/>
  7 <br/>
  2 <br/>
  8 <br/>
  1 <br/>
  9 <br/>
  0 <br/></p>
  
  <p><strong>But what I get is,</strong></p>
  
  <p><a href="https://i.stack.imgur.com/XDgI3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XDgI3.png" alt="enter image description here"></a></p>
  
  <p>I referred below tutorial in order to have some basic knowledge about Concurrent Queues in Swift 3 <br/> 
  <a href="https://www.appcoda.com/grand-central-dispatch/" rel="noreferrer">https://www.appcoda.com/grand-central-dispatch/</a></p>
  
  <p>Can someone tell me what is wrong with my code? or else is it the result I should get? Is there any other ways to get my thing done? Any help would be highly appreciated. </p>