Marc Mutz 4c55f496d7 QThread::terminate(): don't depend on stack unwinding
Posix doesn't seem to specify whether the stack of cancelled threads
is unwound, and there's nothing preventing a QThread from
terminate()ing itself, so be extra careful to drop the mutex before
calling pthread_cancel.

We can't drop the mutex in general, as that would open a window for
the following race condition:

   T1                       T2
   t3->terminate()
     lock();
     read ID;
     terminated = true;
     unlock();
   ----------- t3 exits naturally -----------
                            t3->wait();
                            t4->start(); // gets ex-t3's ID
     pthread_cancel(ID) // oops, cancels new t4

But we can drop it when this == currentThread(), because said window
does not exist: While this_thread is executing terminate(), it cannot
at the same time exit naturally.

As drive-by, scope a variable tighter.

Pick-to: 6.7 6.5
Change-Id: I77a628e62d88e383d5aa91cfd97440186c997fc4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 272c0215c2058bc267abf0a247da878f652eaffa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 08:42:45 +00:00
2024-02-29 15:35:57 +01:00
2024-07-12 01:42:29 +00:00
2024-02-02 15:23:02 +00:00
2024-04-24 19:02:09 +02: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%