mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
bugfix due to capturing of thread index by reference
This commit is contained in:
parent
1b4f596446
commit
402e85cc17
@ -194,11 +194,11 @@ void ParallelFor( int first, int next, const TFunc & f )
|
||||
int nthreads = thread::hardware_concurrency();
|
||||
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] ()
|
||||
{
|
||||
f(myfirst, mynext);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user