title: How to carry out a counter number in parallel_for_each
body: <p>1)Why  the variable length in my sample code are not 62 after calculate ?  It's<br>
    seems every time the condition is satisfied,but enter the condition, 
    the number "length not be added every single time.</p>
  
  <p>2)If I don't use concurrency::array length(1, 1, &amp;V[0]); to save counter
    but using tile_static int, the length is also wrong.</p>
  
  <pre><code>//if my 8 x 8 local data are:
  //cache[TS][TS] 
  //{
  //  -69, 0, 0, 1, 0, 0, 0, 0,
  //    0, 0, 0, 0, 0, 0, 0, 0,
  //    0, 0, 0, 0, 0, 0, 0, 0,
  //    0, 0, 0, 0, 0, 0, 0, 0,
  //    0, 0, 0, 0, 0, 0, 0, 0,
  //    0, 0, 0, 0, 0, 0, 0, 0,
  //    0, 0, 0, 0, 0, 0, 0, 0,
  //    0, 0, 0, 0, 0, 0, 0, 0
  //}
  </code></pre>
  
  <p>My sample code:</p>
  
  <pre><code>void sample()
  {
  
      std::vector&lt;int&gt; V;
      V.push_back(0);
      concurrency::array&lt;int, 2&gt; length(1, 1, &amp;V[0]); 
  
      const int TS = 8;
      concurrency::parallel_for_each(data.extent.tile&lt;TS, TS&gt;(), [=, &amp;length](tiled_index&lt;TS, TS&gt; index) restrict(amp)
      {
          const int row = index.local[0];
          const int col = index.local[1];
  
          //tile_static int length; ---------2)
          tile_static  int cache[TS][TS];
          cache[row][col] = data[index.global];
          index.barrier.wait();
  
          if (cache[row][col] == 0)
          {
              //length++; -------------------2)
              length[0][0] = length[0][0] + 1;
          }
      });
  }
  </code></pre>