QTConcurrent is what you need, and here is a short example.
#include <QCoreApplication> #include <QtConcurrent/QtConcurrent> int plusFunction(int number); int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); int number = 0; QFuture<int> future = QtConcurrent::run(plusFunction, number); QTextStream(stdout) << future.result() << endl; return a.exec(); } int plusFunction(int number) { return number + 1; }
No comments:
Post a Comment