summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-10-03 11:46:57 +0900
committerMichele Calgaro <[email protected]>2024-10-03 11:46:57 +0900
commitc9932b7c1a3ecfc2f4a8c4fbc18e9260e302962d (patch)
tree78149b60e513b2d1a83aa14d8f66b428a6eb14e4
parent24032974c6494ce11d6d0e17a0f9a57294720d9e (diff)
downloadtqt3-c9932b7c1a3ecfc2f4a8c4fbc18e9260e302962d.tar.gz
tqt3-c9932b7c1a3ecfc2f4a8c4fbc18e9260e302962d.zip
Make sure to release thread resources back to the OS once the thread completes.
Threads created with pthread are created in detach mode. Threads created using glib thread functions are instead created as joinable. The fix makes glib-created threads detached, so that the thread resources are released when the thread completes. This resolves TDE/amarok#30 and will benefit any place where a TQThread is used. Manually cherry-picked from commit 81288cfc. Signed-off-by: Michele Calgaro <[email protected]>
-rw-r--r--src/kernel/qthread_unix.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/kernel/qthread_unix.cpp b/src/kernel/qthread_unix.cpp
index be67e002d..b68b5cd7a 100644
--- a/src/kernel/qthread_unix.cpp
+++ b/src/kernel/qthread_unix.cpp
@@ -129,6 +129,7 @@ void *TQThreadInstance::start( void *_arg )
#if defined(QT_USE_GLIBMAINLOOP)
// This is the first time we have access to the native pthread ID of this newly created thread
((TQThreadInstance*)arg[1])->thread_id = pthread_self();
+ pthread_detach(pthread_self());
#endif // QT_USE_GLIBMAINLOOP
#ifdef QT_DEBUG