title: C++ async only uses 2 cores
body: <p>I am using async to run a method simultaneously, but when I check my CPU, it shows that only 2 of 8 are in use. My CPU utilization is about 13%-16% the whole time. 
  The function async should create a new thread with every call and thus should be able to use more processors or did I understand something wrong?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>for (map&lt;string, Cell&gt;::iterator a = cells.begin(); a != cells.end(); ++a)
  {
      for (map&lt;string, Cell&gt;::iterator b = cells.begin(); b != cells.end(); ++b)
      {
          if (a-&gt;first == b-&gt;first)
              continue;
  
          if (_paths.count("path_" + b-&gt;first + "_" + a-&gt;first) &gt; 0)
          {
              continue;
          }
  
          tmp = "path_" + a-&gt;first + "_" + b-&gt;first;
          auto future = async(launch::async, &amp;Pathfinder::findPath, this, &amp;a-&gt;second, &amp;b-&gt;second, collisionZone);
          _paths[tmp] = future.get();
      }
  }
  </code></pre>
  
  <p>Did I get the concept wrong?</p>
  
  <p>EDIT:</p>
  
  <p>Thanks guys, I figured it out now. I didn't know, that calling .get() on the future would wait for it to finish, which afterwards seems only logical...</p>
  
  <p>However, I edited my code now:</p>
  
  <pre><code>    for (map&lt;string, Cell&gt;::iterator a = cells.begin(); a != cells.end(); ++a)
  {
      for (map&lt;string, Cell&gt;::iterator b = cells.begin(); b != cells.end(); ++b)
      {
          if (a-&gt;first == b-&gt;first)
              continue;
  
          if (_paths.count("path_" + b-&gt;first + "_" + a-&gt;first) &gt; 0)
          {
              continue;
          }
  
          tmp = "path_" + a-&gt;first + "_" + b-&gt;first;
          mapBuffer[tmp] = async(launch::async, &amp;Pathfinder::findPath, this, &amp;a-&gt;second, &amp;b-&gt;second, collisionZone);
      }
  }
  
  for (map&lt;string, future&lt;list&lt;Point&gt;&gt;&gt;::iterator i = mapBuffer.begin(); i != mapBuffer.end(); ++i)
  {
      _paths[i-&gt;first] = i-&gt;second.get();
  }
  </code></pre>
  
  <p>It works. Now it spawns threads properly and uses all my cpu power. You saved me a lot of trouble! Thanks again.</p>