summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kernel/tqapplication.cpp67
-rw-r--r--src/kernel/tqapplication.h10
-rw-r--r--src/kernel/tqeventloop_x11.cpp16
-rw-r--r--src/kernel/tqeventloop_x11_glib.cpp24
-rw-r--r--src/kernel/tqobject.cpp2
-rw-r--r--src/kernel/tqthread_unix.cpp2
-rw-r--r--src/kernel/tqwidget.cpp5
-rw-r--r--src/tools/tqthreadinstance_p.h2
-rw-r--r--src/tools/tqthreadstorage_unix.cpp8
9 files changed, 72 insertions, 64 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()
diff --git a/src/kernel/tqapplication.h b/src/kernel/tqapplication.h
index 289df5abf..f8915c5b9 100644
--- a/src/kernel/tqapplication.h
+++ b/src/kernel/tqapplication.h
@@ -285,10 +285,10 @@ public:
void changeAllInputContext( const TQString & );
static bool x11_apply_settings();
#endif
- void wakeUpGuiThread();
+ void wakeUpCoreThread();
#if defined(TQT_THREAD_SUPPORT)
void lock();
- void unlock(bool wakeUpGui = TRUE);
+ void unlock(bool wakeUpCore = TRUE);
bool locked();
bool tryLock();
#endif
@@ -296,7 +296,7 @@ public:
signals:
void lastWindowClosed();
void aboutToQuit();
- void guiThreadAwake();
+ void coreThreadAwake();
public slots:
void quit();
@@ -436,10 +436,10 @@ private:
public:
#ifdef TQT_THREAD_SUPPORT
- static TQThread* guiThread();
+ static TQThread* coreThread();
static void threadTerminationHandler( TQThread * );
#endif
- static bool isGuiThread();
+ static bool isCoreThread();
};
inline int TQApplication::argc() const
diff --git a/src/kernel/tqeventloop_x11.cpp b/src/kernel/tqeventloop_x11.cpp
index 09fc42e82..97fb570dd 100644
--- a/src/kernel/tqeventloop_x11.cpp
+++ b/src/kernel/tqeventloop_x11.cpp
@@ -146,7 +146,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
if ( tqt_is_gui_used ) {
TQApplication::sendPostedEvents();
- if (TQApplication::isGuiThread()) {
+ if (TQApplication::isCoreThread()) {
// Two loops so that posted events accumulate
while ( XPending( TQPaintDevice::x11AppDisplay() ) ) {
// also flushes output buffer
@@ -220,7 +220,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
static timeval zerotm;
timeval *tm = 0;
if ( ! ( flags & ExcludeTimers ) ) {
- if (TQApplication::isGuiThread()) {
+ if (TQApplication::isCoreThread()) {
tm = qt_wait_timer(); // wait for TQt timers
if ( !canWait ) {
if ( !tm )
@@ -235,7 +235,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
// Socket notifier events are only activated in the core application event loop,
// so filter them out in other event loops.
int highest = 0;
- if (!(flags & ExcludeSocketNotifiers) && TQApplication::isGuiThread()) {
+ if (!(flags & ExcludeSocketNotifiers) && TQApplication::isCoreThread()) {
// return the highest fd we can wait for input on
if ( d->sn_highest >= 0 ) { // has socket notifier(s)
if ( d->sn_vec[0].list && ! d->sn_vec[0].list->isEmpty() )
@@ -266,7 +266,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
FD_ZERO( &d->sn_vec[2].select_fds );
}
- if ( tqt_is_gui_used && TQApplication::isGuiThread() ) {
+ if ( tqt_is_gui_used && TQApplication::isCoreThread() ) {
// select for events on the event socket - only on X11
FD_SET( d->xfd, &d->sn_vec[0].select_fds );
highest = TQMAX( highest, d->xfd );
@@ -308,7 +308,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
// we are awake, broadcast it
emit awake();
- emit tqApp->guiThreadAwake();
+ emit tqApp->coreThreadAwake();
if (nsel == -1) {
if (errno == EBADF) {
@@ -374,7 +374,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
// activate socket notifiers
if (!(flags & ExcludeSocketNotifiers) && nsel > 0 && d->sn_highest >= 0 &&
- TQApplication::isGuiThread()) {
+ TQApplication::isCoreThread()) {
// if select says data is ready on any socket, then set the socket notifier
// to pending
int i;
@@ -396,7 +396,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
// activate timers
if ( ! ( flags & ExcludeTimers ) ) {
- if (TQApplication::isGuiThread()) {
+ if (TQApplication::isCoreThread()) {
nevents += activateTimers();
}
}
@@ -415,7 +415,7 @@ bool TQEventLoop::hasPendingEvents() const
#endif // TQT_THREAD_SUPPORT
extern uint qGlobalPostedEventsCount(); // from tqapplication.cpp
- return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isGuiThread()) ? XPending( TQPaintDevice::x11AppDisplay() ) : 0));
+ return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isCoreThread()) ? XPending( TQPaintDevice::x11AppDisplay() ) : 0));
}
void TQEventLoop::appStartingUp()
diff --git a/src/kernel/tqeventloop_x11_glib.cpp b/src/kernel/tqeventloop_x11_glib.cpp
index ba638aac9..fa449ca07 100644
--- a/src/kernel/tqeventloop_x11_glib.cpp
+++ b/src/kernel/tqeventloop_x11_glib.cpp
@@ -207,7 +207,7 @@ void TQEventLoop::init()
// intitialize the X11 parts of the event loop
d->xfd = -1;
- if ( tqt_is_gui_used && TQApplication::isGuiThread() ) {
+ if ( tqt_is_gui_used && TQApplication::isCoreThread() ) {
d->xfd = XConnectionNumber( TQPaintDevice::x11AppDisplay() );
}
@@ -231,7 +231,7 @@ void TQEventLoop::init()
d->gSource = (GSource*)qtGSource;
// poll for X11 events
- if ( tqt_is_gui_used && TQApplication::isGuiThread() ) {
+ if ( tqt_is_gui_used && TQApplication::isCoreThread() ) {
d->x_gPollFD.fd = d->xfd;
d->x_gPollFD.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
g_source_add_poll(d->gSource, &d->x_gPollFD);
@@ -315,7 +315,7 @@ bool TQEventLoop::processX11Events()
if ( tqt_is_gui_used ) {
TQApplication::sendPostedEvents();
- if (TQApplication::isGuiThread()) {
+ if (TQApplication::isCoreThread()) {
// Two loops so that posted events accumulate
while ( XPending( TQPaintDevice::x11AppDisplay() ) ) {
// also flushes output buffer
@@ -407,7 +407,7 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout)
static timeval zerotm;
timeval *tm = 0;
if ( ! ( flags & ExcludeTimers ) ) {
- if (TQApplication::isGuiThread()) {
+ if (TQApplication::isCoreThread()) {
tm = qt_wait_timer(); // wait for TQt timers
if ( !canWait ) {
if ( !tm ) {
@@ -422,7 +422,7 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout)
// Include or exclude SocketNotifiers (by setting or cleaning poll events)
// Socket notifier events are only activated in the core application event loop,
// so filter them out in other event loops.
- if (!(flags & ExcludeSocketNotifiers) && TQApplication::isGuiThread()) {
+ if (!(flags & ExcludeSocketNotifiers) && TQApplication::isCoreThread()) {
TQPtrListIterator<TQSockNotGPollFD> it( d->sn_list );
TQSockNotGPollFD *sn;
while ( (sn=it.current()) ) {
@@ -496,7 +496,7 @@ bool TQEventLoop::gsourceCheck(GSource *gs) {
ProcessEventsFlags flags = d->pev_flags;
// Socketnotifier events?
- if (!(flags & ExcludeSocketNotifiers) && TQApplication::isGuiThread())
+ if (!(flags & ExcludeSocketNotifiers) && TQApplication::isCoreThread())
{
TQPtrListIterator<TQSockNotGPollFD> it( d->sn_list );
TQSockNotGPollFD *sn;
@@ -531,7 +531,7 @@ bool TQEventLoop::gsourceCheck(GSource *gs) {
}
// check if we have timers to activate?
- if (TQApplication::isGuiThread()) {
+ if (TQApplication::isCoreThread()) {
timeval *tm = qt_wait_timer();
if (tm && (tm->tv_sec == 0 && tm->tv_usec == 0 )) {
#ifdef DEBUG_QT_GLIBMAINLOOP
@@ -571,7 +571,7 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) {
// we are awake, broadcast it
emit awake();
- emit tqApp->guiThreadAwake();
+ emit tqApp->coreThreadAwake();
// some other thread woke us up... consume the data on the thread pipe so that
// select doesn't immediately return next time
@@ -603,14 +603,14 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) {
}
// }
- if (TQApplication::isGuiThread()) {
+ if (TQApplication::isCoreThread()) {
nevents += activateSocketNotifiers();
}
}
// activate timers
if ( ! ( flags & ExcludeTimers ) ) {
- if (TQApplication::isGuiThread()) {
+ if (TQApplication::isCoreThread()) {
nevents += activateTimers();
}
}
@@ -653,14 +653,14 @@ bool TQEventLoop::hasPendingEvents() const
#endif // TQT_THREAD_SUPPORT
extern uint qGlobalPostedEventsCount(); // from tqapplication.cpp
- return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isGuiThread()) ? XPending( TQPaintDevice::x11AppDisplay() ) : 0));
+ return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isCoreThread()) ? XPending( TQPaintDevice::x11AppDisplay() ) : 0));
}
void TQEventLoop::appStartingUp()
{
if ( tqt_is_gui_used ) {
d->xfd = XConnectionNumber( TQPaintDevice::x11AppDisplay() );
- if ( (d->x_gPollFD.fd == -1) && TQApplication::isGuiThread() ) {
+ if ( (d->x_gPollFD.fd == -1) && TQApplication::isCoreThread() ) {
d->x_gPollFD.fd = d->xfd;
d->x_gPollFD.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
g_source_add_poll(d->gSource, &d->x_gPollFD);
diff --git a/src/kernel/tqobject.cpp b/src/kernel/tqobject.cpp
index 5b2d3fd68..ec31f6cd6 100644
--- a/src/kernel/tqobject.cpp
+++ b/src/kernel/tqobject.cpp
@@ -184,7 +184,7 @@ void TQObject::setThreadObject_helper(TQThread *targetThread)
Changes the thread affinity for this object and its children. The
object cannot be moved if it has a parent. Event processing will
continue in the \a targetThread. To move an object to the main
- thread, pass TQApplication::guiThread() as the \a targetThread.
+ thread, pass TQApplication::coreThread() as the \a targetThread.
Note that all active timers for the object will be reset. The
timers are first stopped in the current thread and restarted (with
diff --git a/src/kernel/tqthread_unix.cpp b/src/kernel/tqthread_unix.cpp
index a84663df6..27b8ec7af 100644
--- a/src/kernel/tqthread_unix.cpp
+++ b/src/kernel/tqthread_unix.cpp
@@ -171,7 +171,7 @@ void TQThreadInstance::finish( void * )
}
}
-void TQThreadInstance::finishGuiThread(TQThreadInstance *d) {
+void TQThreadInstance::finishCoreThread(TQThreadInstance *d) {
TQThreadStorageData::finish( d->thread_storage );
d->thread_storage = 0;
}
diff --git a/src/kernel/tqwidget.cpp b/src/kernel/tqwidget.cpp
index 71fe8ea16..ac56e302a 100644
--- a/src/kernel/tqwidget.cpp
+++ b/src/kernel/tqwidget.cpp
@@ -882,13 +882,12 @@ TQWidget::TQWidget( TQWidget *parent, const char *name, WFlags f, NFlags n )
{
#if defined(QT_CHECK_STATE) && !defined(TQ_WS_WIN)
if ( tqApp->type() == TQApplication::Tty ) {
- tqWarning( "TQWidget: Cannot create a TQWidget when no GUI "
- "is being used" );
+ tqFatal( "TQWidget: Cannot create a TQWidget when no GUI is being used" );
}
#endif
#if defined(TQT_THREAD_SUPPORT) && defined(QT_CHECK_STATE)
- if (TQThread::currentThreadObject() != TQApplication::guiThread()) {
+ if (!TQApplication::isCoreThread()) {
tqFatal( "TQWidget: Cannot create a TQWidget outside of the main GUI thread" );
}
#endif
diff --git a/src/tools/tqthreadinstance_p.h b/src/tools/tqthreadinstance_p.h
index 2778d5daa..ea34f3c5f 100644
--- a/src/tools/tqthreadinstance_p.h
+++ b/src/tools/tqthreadinstance_p.h
@@ -100,7 +100,7 @@ public:
static void finish( TQThreadInstance * );
#endif // Q_OS_WIN32
- static void finishGuiThread( TQThreadInstance *d );
+ static void finishCoreThread( TQThreadInstance *d );
TQEventLoop* eventLoop;
int cleanupType;
diff --git a/src/tools/tqthreadstorage_unix.cpp b/src/tools/tqthreadstorage_unix.cpp
index 977ccf6bb..71b10822b 100644
--- a/src/tools/tqthreadstorage_unix.cpp
+++ b/src/tools/tqthreadstorage_unix.cpp
@@ -90,14 +90,14 @@ TQThreadStorageData::TQThreadStorageData( void (*func)( void * ) )
TQThreadStorageData::~TQThreadStorageData()
{
- // The Gui thread has static storage duration, TQThreadStorage are almost always static (it's
+ // The core thread has static storage duration, TQThreadStorage are almost always static (it's
// technically possible to allocate those in the heap, but it's quite unusual). It's impossible
// to predict whichever of those one gets destroyed first, but usually it's a TQThreadStorage.
// In that case we have to do the cleanup of its storage ourself as it won't be possible after
// nullifying the destructor below.
- TQThread *guiThread = TQApplication::guiThread();
- if (guiThread) {
- TQThreadInstance *d = guiThread->d;
+ TQThread *coreThread = TQApplication::coreThread();
+ if (coreThread) {
+ TQThreadInstance *d = coreThread->d;
TQMutexLocker locker( d->mutex() );
if (d->thread_storage && d->thread_storage[id]) {
thread_storage_usage[id].func( d->thread_storage[id] );