diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-10-02 11:01:35 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-10-02 11:16:24 +0900 |
commit | 81288cfcb6a543d96a1ee4bf1d7d3c26231f517f (patch) | |
tree | c18c9250ffcb6507a81f823037559998f9934c3a | |
parent | 24b42848c1a580f90e84e2e5f0f030eaa58871a8 (diff) | |
download | tqt3-81288cfcb6a543d96a1ee4bf1d7d3c26231f517f.tar.gz tqt3-81288cfcb6a543d96a1ee4bf1d7d3c26231f517f.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.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r-- | src/kernel/tqthread_unix.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/kernel/tqthread_unix.cpp b/src/kernel/tqthread_unix.cpp index c6662dbeb..00c389d20 100644 --- a/src/kernel/tqthread_unix.cpp +++ b/src/kernel/tqthread_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 |