hi,
i have this strange (to me) problem. I have a function in which i make the following function calls:
Code:
vector<Tint> segments = bounds(static_cast<Tint>(thr),static_cast<Tint>(vec.size()+1));
cerr << segments << endl;
/* Launch threads */
for (Tint i = 0; i < thr; ++i)
threads.push_back(thread(MakeGraph<Tint, Tfa, Tbobj>, ref(Ses), segments[i], segments[i+1]-1, static_cast<Tint>(vec.size()), ref(parent), ref(child), ref(Obj)));
/* Join the threads with the main thread */
cerr << "Joining\n";
for(auto &t : threads)
t.join();
cerr << "Done\n";
as a result i get:
Code:
0
785
1656
2644
3816
5344
9032
Joining
Segmentation fault
so before joining my program breaks. if i use only 1 thre4ad it works ok. I need the program to be able to run several threads in parallel. Is there some obvious reason why thi fails (because one of the potential problems could be in ref(Obj) but i wish to eliminate trivialities first)
does anyone see and obvious problems? is there something i might be forgetting during the compilation ?
thnx