Skip to content

Commit

Permalink
Fix crash in clusted fork-join algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
robbr48 committed May 15, 2024
1 parent 7666888 commit eb90f09
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions HopsanCore/src/ComponentSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2770,28 +2770,28 @@ void ComponentSystem::simulateMultiThreaded(const double startT, const double st
}

//C components
tt = new std::thread[mComponentCptrs.size()];
for (size_t c=0; c < mComponentCptrs.size(); ++c)
tt = new std::thread[mpMultiThreadPrivates->mSplitCVector.size()];
for (size_t c=0; c < mpMultiThreadPrivates->mSplitCVector.size(); ++c)
{
tt[c] = std::thread(simOneStep,
&mpMultiThreadPrivates->mSplitCVector[c],
mTime);
}
for(size_t c=0; c<mComponentCptrs.size(); ++c)
for(size_t c=0; c<mpMultiThreadPrivates->mSplitCVector.size(); ++c)
{
tt[c].join();
}
delete[] tt;

//Q components
tt = new std::thread[mComponentQptrs.size()];
for (size_t q=0; q < mComponentQptrs.size(); ++q)
tt = new std::thread[mpMultiThreadPrivates->mSplitQVector.size()];
for (size_t q=0; q < mpMultiThreadPrivates->mSplitQVector.size(); ++q)
{
tt[q] = std::thread(simOneStep,
&mpMultiThreadPrivates->mSplitQVector[q],
mTime);
}
for(size_t q=0; q<mComponentQptrs.size(); ++q)
for(size_t q=0; q<mpMultiThreadPrivates->mSplitQVector.size(); ++q)
{
tt[q].join();
}
Expand Down

0 comments on commit eb90f09

Please sign in to comment.