diff options
Diffstat (limited to 'src/kernel/tqapplication.cpp')
-rw-r--r-- | src/kernel/tqapplication.cpp | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/src/kernel/tqapplication.cpp b/src/kernel/tqapplication.cpp index 1cc5bf140..e6aad87c4 100644 --- a/src/kernel/tqapplication.cpp +++ b/src/kernel/tqapplication.cpp @@ -264,7 +264,7 @@ \i Threading \i lock(), unlock(), locked(), tryLock(), - wakeUpGuiThread() + wakeUpCoreThread() \row \i Miscellaneous @@ -393,21 +393,19 @@ TQ_EXPORT TQt::HANDLE tqt_get_application_thread_id() TQEventLoop *TQApplication::eventloop = 0; // application event loop #endif -#ifdef TQT_THREAD_SUPPORT TQEventLoop* TQApplication::currentEventLoop() { - TQThread* thread = TQThread::currentThreadObject(); +#ifdef TQT_THREAD_SUPPORT + TQThread *thread = TQThread::currentThreadObject(); if (thread) { if (thread->d) { return thread->d->eventLoop; } } return NULL; -} #else -TQEventLoop* TQApplication::currentEventLoop() { return TQApplication::eventloop; -} #endif +} #ifndef TQT_NO_ACCEL extern bool tqt_dispatchAccelEvent( TQWidget*, TQKeyEvent* ); // def in tqaccel.cpp @@ -569,8 +567,8 @@ public: // avoid warning from TQThread d->running = false; - // do some cleanup, namely clean up the thread-local storage associated with the GUI thread - TQThreadInstance::finishGuiThread(d); + // do some cleanup, namely clean up the thread-local storage associated with the core thread + TQThreadInstance::finishCoreThread(d); } static TQCoreApplicationThread* self() { return tqt_gui_thread_self; } @@ -1081,18 +1079,18 @@ TQApplication::TQApplication(Display *dpy, int argc, char **argv, #endif // TQ_WS_X11 #ifdef TQT_THREAD_SUPPORT -TQThread* TQApplication::guiThread() { +TQThread* TQApplication::coreThread() { return TQCoreApplicationThread::self(); } +#endif -bool TQApplication::isGuiThread() { - return (TQThread::currentThreadObject() == guiThread()); -} +bool TQApplication::isCoreThread() { +#ifdef TQT_THREAD_SUPPORT + return (TQThread::currentThreadObject() == coreThread()); #else -bool TQApplication::isGuiThread() { return true; -} #endif +} void TQApplication::init_precmdline() { @@ -2472,12 +2470,12 @@ void TQApplication::aboutTQt() /*! - \fn void TQApplication::guiThreadAwake() + \fn void TQApplication::coreThreadAwake() This signal is emitted after the event loop returns from a function that could block. - \sa wakeUpGuiThread() + \sa wakeUpCoreThread() */ @@ -3078,7 +3076,7 @@ int TQApplication::exec() void TQApplication::exit( int retcode ) { #ifdef TQT_THREAD_SUPPORT - TQThread* thread = tqApp->guiThread(); + TQThread* thread = tqApp->coreThread(); if (thread) { if (thread->d) { if (thread->d->eventLoop) { @@ -3087,7 +3085,7 @@ void TQApplication::exit( int retcode ) } } #else - tqApp->eventLoop()->exit( retcode ); + TQApplication::eventLoop()->exit( retcode ); #endif // TQT_THREAD_SUPPORT } @@ -3134,13 +3132,24 @@ int TQApplication::loopLevel() const /*! - Wakes up the GUI thread. + Wakes up the core application thread. - \sa guiThreadAwake() \link threads.html Thread Support in TQt\endlink + \sa coreThreadAwake() \link threads.html Thread Support in TQt\endlink */ -void TQApplication::wakeUpGuiThread() +void TQApplication::wakeUpCoreThread() { - eventLoop()->wakeUp(); +#ifdef TQT_THREAD_SUPPORT + TQThread* thread = tqApp->coreThread(); + if (thread) { + if (thread->d) { + if (thread->d->eventLoop) { + thread->d->eventLoop->wakeUp(); + } + } + } +#else + TQApplication::eventLoop()->wakeUp(); +#endif // TQT_THREAD_SUPPORT } /*! @@ -3866,7 +3875,7 @@ static void tqThreadTerminationHandlerRecursive( TQObject* object, TQThread* ori */ void TQApplication::threadTerminationHandler( TQThread *originThread ) { TQMutexLocker locker( tqt_mutex ); - TQThread* destinationThread = guiThread(); + TQThread* destinationThread = coreThread(); const TQObjectList* objects = TQObject::objectTrees(); for ( TQObjectListIt objectit( *objects ) ; *objectit; ++objectit ) { tqThreadTerminationHandlerRecursive((*objectit), originThread, destinationThread); @@ -4189,10 +4198,10 @@ bool TQApplication::desktopSettingsAware() */ -/*! \fn void TQApplication::unlock(bool wakeUpGui) +/*! \fn void TQApplication::unlock(bool wakeUpCore) - Unlock the TQt Library Mutex. If \a wakeUpGui is TRUE (the default), - then the GUI thread will be woken with TQApplication::wakeUpGuiThread(). + Unlock the TQt Library Mutex. If \a wakeUpCore is TRUE (the default), + then the core application thread will be woken with TQApplication::wakeUpCoreThread(). \sa lock(), locked() \link threads.html Thread Support in TQt\endlink */ @@ -4229,12 +4238,12 @@ void TQApplication::lock() tqt_mutex->lock(); } -void TQApplication::unlock(bool wakeUpGui) +void TQApplication::unlock(bool wakeUpCore) { tqt_mutex->unlock(); - if (wakeUpGui) - wakeUpGuiThread(); + if (wakeUpCore) + wakeUpCoreThread(); } bool TQApplication::locked() |