title: How many threads in swift playground?
body: <pre><code>let conc = DispatchQueue(label: &quot;test&quot;, attributes: .concurrent)
  conc.sync {
      conc.async {
          var x = 1
          for n in 1...100000 {
              x += n
          }
          print(2)
      }
  
      var x = 1
      for n in 1...100000 {
          x += n
      }
      print(3)
  }
  print(1)
  </code></pre>
  <p>Always print <code>3, 1, 2</code>. Why? In my opinion it should print <code>1, 3, 2</code>. Because <code>1</code> and <code>3</code> are at different threads and in this code tasks for <code>1, 2 and 3</code> goes simultaneously. Is there only one thread in Playground and in real app it would print <code>1, 3, 2</code>? Could somebody explain please.</p>