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>
pull/192/head
Michele Calgaro 2 months ago
parent 24b42848c1
commit 81288cfcb6
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -129,6 +129,7 @@ void *TQThreadInstance::start( void *_arg )
#if defined(QT_USE_GLIBMAINLOOP) #if defined(QT_USE_GLIBMAINLOOP)
// This is the first time we have access to the native pthread ID of this newly created thread // 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(); ((TQThreadInstance*)arg[1])->thread_id = pthread_self();
pthread_detach(pthread_self());
#endif // QT_USE_GLIBMAINLOOP #endif // QT_USE_GLIBMAINLOOP
#ifdef QT_DEBUG #ifdef QT_DEBUG

Loading…
Cancel
Save