qt5base-lts/tests/auto/corelib/thread/qthread
Ievgenii Meshcheriakov 52ad59f9ea QThread: Reset the system thread ID when thread exits on Unix
Unix QThread implementation stores pthread_t as a system thread ID
when the thread is created, but never resets the system ID when
those threads are destroyed. Some implementations may reuse the
same thread IDs for new threads, and this may cause QThread::wait()
to erroneously complain that "Thread tried to wait on itself".

This patch sets the system thread ID to nullptr when the thread is
about to exit and be destroyed by the system.

A regression test is added to tst_qthread.

Fixes: QTBUG-96846
Pick-to: 5.15 6.2
Change-Id: I0850425dd0e09af50e59c9038e7e662a2a624beb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-29 01:53:49 +02:00
..
.gitignore Moving relevant tests to corelib/thread 2011-09-01 12:54:58 +02:00
BLACKLIST Update for failures only on dev branch. Use general platform names 2019-08-19 18:22:11 +02:00
CMakeLists.txt Move QEMU emulation detector to QTest 2021-02-13 10:02:51 +02:00
tst_qthread.cpp QThread: Reset the system thread ID when thread exits on Unix 2021-09-29 01:53:49 +02:00