wysota, yes I've been testing with the same exact code. It does run and I started getting errors when I raised the SIZE. I fixed the errors by replacing the last three lines with this:
QFuture<void> res = QtConcurrent::map(data, Func);
res.waitForFinished();
return 0;
QFuture<void> res = QtConcurrent::map(data, Func);
res.waitForFinished();
return 0;
To copy to clipboard, switch view to plain text mode
I do monitor it during run-time with top, and both cores are used, but they never rise above 50%. They usually hover around 30-40%. The single-threaded version runs on one core, but at 100%.
numbat, I removed the if-else block just so there are no errors in the code, but it still runs several times slower than the single-threaded version. About ten times slower to be exact.
Tanuki-no, QThread::idealThreadCount() returns 2 for my system, which is correct.
Bookmarks