diff options
author | Timothy Pearson <[email protected]> | 2013-05-14 19:35:54 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-05-14 19:35:54 -0500 |
commit | 9a4765a62e321af08ec96a03cdbef64039788e86 (patch) | |
tree | fd261fdcf042d490030a2a1d337cf1b7cc8b514f /src/kernel/qthread_unix.cpp | |
parent | c740211ffba3330d951f4c3ddefea8edf23a01cd (diff) | |
download | tqt3-9a4765a62e321af08ec96a03cdbef64039788e86.tar.gz tqt3-9a4765a62e321af08ec96a03cdbef64039788e86.zip |
Automated update from Qt3
Diffstat (limited to 'src/kernel/qthread_unix.cpp')
-rw-r--r-- | src/kernel/qthread_unix.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/kernel/qthread_unix.cpp b/src/kernel/qthread_unix.cpp index 0d7c657f3..13c820e23 100644 --- a/src/kernel/qthread_unix.cpp +++ b/src/kernel/qthread_unix.cpp @@ -47,6 +47,7 @@ typedef pthread_mutex_t Q_MUTEX_T; #include <private/qmutex_p.h> #include <private/qmutexpool_p.h> #include <ntqthreadstorage.h> +#include <ntqapplication.h> #include <errno.h> #include <sched.h> @@ -109,6 +110,7 @@ void TQThreadInstance::init(unsigned int stackSize) thread_id = 0; eventLoop = 0; + cleanupType = TQThread::CleanupMergeObjects; // threads have not been initialized yet, do it now if (! qt_thread_mutexpool) TQThread::initialize(); @@ -150,6 +152,8 @@ void TQThreadInstance::finish( void * ) return; } + TQApplication::threadTerminationHandler((TQThread*)d->args[0]); + TQMutexLocker locker( d->mutex() ); d->running = FALSE; d->finished = TRUE; @@ -179,7 +183,6 @@ void TQThreadInstance::terminate() pthread_cancel( thread_id ); } - /************************************************************************** ** TQThread *************************************************************************/ @@ -398,6 +401,9 @@ void TQThread::start(Priority priority) d->args[0] = this; d->args[1] = d; #if defined(QT_USE_GLIBMAINLOOP) + // The correct thread_id is set in TQThreadInstance::start using the value of d->args[1] + d->thread_id = NULL; + // Legacy glib versions require this threading system initialization call g_thread_init(NULL); @@ -408,8 +414,6 @@ void TQThread::start(Priority priority) else { ret = -1; } - // The correct thread_id is set in TQThreadInstance::start using the value of d->args[1] - d->thread_id = NULL; #else // QT_USE_GLIBMAINLOOP ret = pthread_create( &d->thread_id, &attr, (TQtThreadCallback)TQThreadInstance::start, d->args ); #if defined (Q_OS_HPUX) @@ -496,6 +500,36 @@ bool TQThread::wait( unsigned long time ) } /*! + Returns the current cleanup behaviour of the thread. + + \sa setCleanupType + \sa CleanupType +*/ + +TQThread::CleanupType TQThread::cleanupType() { + return (TQThread::CleanupType)d->cleanupType; +} + +/*! + Sets the current cleanup behaviour of the thread. The default, + TQThread::CleanupMergeObjects, will merge any objects owned by this thread + with the main GUI thread when this thread is terminated. + + If faster thread termination performance is desired, TQThread::CleanupNone + may be specified instead. However, this is not recommended as any objects + owned by this thread on termination can then cause events to become "stuck" + in the global event queue, leading to high CPU usage and other undesirable + behavior. You have been warned! + + \sa cleanupType + \sa CleanupType +*/ + +void TQThread::setCleanupType(CleanupType type) { + d->cleanupType = type; +} + +/*! Returns a pointer to the currently executing TQThread. If the current thread was not started using the TQThread API, this function returns zero. |