mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
bugfix due to capturing of thread index by reference
This commit is contained in:
parent
1b4f596446
commit
402e85cc17
@ -195,10 +195,10 @@ void ParallelFor( int first, int next, const TFunc & f )
|
||||
thread * threads = new thread[nthreads];
|
||||
for (int i=0; i<nthreads; i++)
|
||||
{
|
||||
threads[i] = std::thread( [&] ()
|
||||
int myfirst = first + (next-first)*i/nthreads;
|
||||
int mynext = first + (next-first)*(i+1)/nthreads;
|
||||
threads[i] = std::thread( [myfirst,mynext,&f] ()
|
||||
{
|
||||
int myfirst = first + (next-first)*i/nthreads;
|
||||
int mynext = first + (next-first)*(i+1)/nthreads;
|
||||
f(myfirst, mynext);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user