Thiago Macieira 4f85eed8e3 QThread: avoid unlock/lock/unlock in ~QThread if state is Finishing
This is a corner-case scenario but valid because we tell users they can
destroy the QThread object right after finished() has been emitted. But
emitting finished() does not mean the launched thread has actually
exited: it may still be in Finishing state for an arbitrarily long time.
Completely aside from what else may run from other libraries, we only
destroy QThreadStorage and the thread's event dispatcher after
finished() has been emitted.

This commit avoids the unnecessary mutex unlocking in the destructor,
then QThread::wait() locking again, only to unlock yet again so that it
can perform the necessary low-level wait calls. The same for the return
path: wait() locked again to check the state, then unlocked, only for
the destructor to lock again. Now, QThreadPrivate::wait() is responsible
for returning with a locked mutex.

Change-Id: I87adffb89f275accea18fffd6b4293861ea7cf39
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6bd271cf74d6d57816531f688c82c51d29f1be91)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-11-07 15:00:11 -07:00
2024-11-07 08:38:49 +01:00
2024-11-07 08:38:49 +01:00
2015-08-18 19:59:14 +00:00
2024-11-07 08:38:49 +01:00
2024-11-07 08:38:49 +01:00
2024-11-07 08:38:49 +01:00
2024-02-02 15:23:02 +00:00
2024-11-07 08:38:49 +01:00
Description
Qt Base (Core, Gui, Widgets, Network, ...)
822 MiB
Languages
C++ 84.3%
HTML 4.9%
C 3.9%
CMake 3.6%
Objective-C++ 2%
Other 0.8%