vendredi 3 juillet 2015

segmentation fault std::thread join c++

I run into a segmentation fault when it comes to joining all the threads to the main thread.

for (int k = wid-1; k>=1; k--)
{
  x = k;
  std::thread tt[x];
  for(int i = 0; i < y; i++)
  {

    int temp[SIZE+1][SIZE+1];       
    int ref[SIZE][SIZE];  

    for(int j = 0; j < x; j++)
       tt[j] = std::thread(func,reference, matrix, cols, pen, i, wid, temp, ref, i, j);


    std::cout << "Done\n";

    for(int j = 0; j < x; j++)
        tt[j].join();
  }
}

This is my console output (Ubuntu 15.04):

Done
Segmentation fault (core dumped)

Aucun commentaire:

Enregistrer un commentaire