I am trying out the wordcount example in QT concurrent MapReduce. This program runs fine when I keep the single threaded portion of the code in main.cpp along with multithreaded portion. If I comment out the single threaded portion in the code, the program runs successfully but returns a segfault in the end. I am able to see the result accurately, but I am just concerned about the segfault which occurs after. I have tried this on two different machines but landed up in same problem. Can someone help me resolve this please? Has anyone else faced the same problem?
Regards,
Anup Tapadia
CODE ------------------------------------------------------------
int main()
{
qDebug() << "finding files";
QStringList files = findFiles("/home/anup/Desktop/deepak/", QStringList() << "*");
qDebug() << files.count() << "files";
int singleThreadTime = 0;
/*
int unq_users=0;
{
QTime time;
time.start();
WordCount total = singleThreadedWordCount(files);
singleThreadTime = time.elapsed();
unq_users = total.count();
qDebug() << "single thread" << singleThreadTime;
}
*/
int mapReduceTime = 0;
int unique_count = 0;
QTime time;
time.start();
WordCount total = mappedReduced(files, countWords, reduce);
mapReduceTime = time.elapsed();
unique_count = total.count();
qDebug() << "MapReduce" << mapReduceTime;
//qDebug() << "MapReduce speedup x" << ((double)singleThreadTime - (double)mapReduceTime) / (double)mapReduceTime + 1;
return 0;
}
----------------------------------------------------------------------------------------------------------------------------