I run 3 parallel threads (plus current thread) in a method to parallelize calls to na optimization method. Code looks like
for(i=0;i<m+1;i++)
{ // run algorithms
solverParallelData* parallelData = new solverParallelData(this);
for(j=0;j<m_ndim;j++)
{
initPt[j] = initPts[i][j];
}
parallelData->runOptim(initPt);
dataList.append(parallelData);
}
// retrieve results
solverParallelData *parallelDataRes;
try
{
for(int i = 0; i < dataList.size(); i++)
{
parallelDataRes = dataList.at(i);
int output = parallelDataRes->resultOptim();
/*...*/
}
where resultOptim() is a method in solverParallelData simply calling QFuture result(). The dataList seems to be filled properly. However, the line
int output = parallelDataRes->resultOptim();
gives an unhandled exception which I cannot identify. Previouly, I had issues with concurrent access, and program crashes in QMutex class. Now I guess the source is different, but I cannot figure out what is wrong.
Thanks and regards.