diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2021-09-30 16:10:02 +0200 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2021-10-01 02:46:17 +0200 |
commit | e0b87edd73c4ade9f35985313b19d8f2f1f9ca78 (patch) | |
tree | cd12c4f77d4381972ceea7621523492767f825e7 /tests/auto/corelib/thread/qthread | |
parent | 44a74127954dce2416842a6644cbdff4c513b6fb (diff) |
tst_qthread: Don't use QVERIFY in multiple threads in threadIdReuse()
Testlib is not thread safe. Store the status into variable and check
it in the main thread instead.
Pick-to: 6.2
Change-Id: I840c8a3dceb1115a1b81ffeaa0fab96f9d2f1ff0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/thread/qthread')
-rw-r--r-- | tests/auto/corelib/thread/qthread/tst_qthread.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 704eb14e14..a396ebffc2 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -1660,14 +1660,17 @@ void tst_QThread::threadIdReuse() QThread::msleep(1); Qt::HANDLE threadId2; - auto waitForThread1 = [&thread1, &threadId2]() -> void { + bool waitOk = false; + + auto waitForThread1 = [&thread1, &threadId2, &waitOk]() -> void { threadId2 = QThread::currentThreadId(); - QVERIFY(thread1->wait()); + waitOk = thread1->wait(); }; QScopedPointer<QThread> thread2(QThread::create(waitForThread1)); thread2->start(); QVERIFY(thread2->wait()); + QVERIFY(waitOk); if (threadId1 == threadId2) { qDebug("Thread ID reused at iteration %d", i); |