#include #include #include #include #include "testobject.h" #include void threadProc() { qDebug() << "This will lead to race condition"; } void TestClass::TestRaceCondition() { for(int i = 0; i < 4; ++i) { QtConcurrent::run(threadProc); } } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); TestClass testObject; for(int t = 0; t < 4; ++t) { QTest::qExec(&testObject, QStringList()); qInfo() << "alive?"; } return 0; }