diff options
Diffstat (limited to 'src/kernel')
| -rw-r--r-- | src/kernel/ntqapplication.h | 18 | ||||
| -rw-r--r-- | src/kernel/ntqeventloop.h | 4 | ||||
| -rw-r--r-- | src/kernel/ntqgplugin.h | 2 | ||||
| -rw-r--r-- | src/kernel/ntqobject.h | 6 | ||||
| -rw-r--r-- | src/kernel/ntqthread.h | 4 | ||||
| -rw-r--r-- | src/kernel/qapplication.cpp | 78 | ||||
| -rw-r--r-- | src/kernel/qapplication_x11.cpp | 10 | ||||
| -rw-r--r-- | src/kernel/qeventloop.cpp | 10 | ||||
| -rw-r--r-- | src/kernel/qeventloop_unix_glib.cpp | 74 | ||||
| -rw-r--r-- | src/kernel/qeventloop_x11.cpp | 10 | ||||
| -rw-r--r-- | src/kernel/qeventloop_x11_glib.cpp | 23 | ||||
| -rw-r--r-- | src/kernel/qfont_x11.cpp | 4 | ||||
| -rw-r--r-- | src/kernel/qmetaobject.cpp | 24 | ||||
| -rw-r--r-- | src/kernel/qobject.cpp | 164 | ||||
| -rw-r--r-- | src/kernel/qthread.cpp | 6 | ||||
| -rw-r--r-- | src/kernel/qthread_unix.cpp | 4 | ||||
| -rw-r--r-- | src/kernel/qwidget.cpp | 4 |
17 files changed, 208 insertions, 237 deletions
diff --git a/src/kernel/ntqapplication.h b/src/kernel/ntqapplication.h index 4696b290e..8cecb73e8 100644 --- a/src/kernel/ntqapplication.h +++ b/src/kernel/ntqapplication.h @@ -61,10 +61,10 @@ class TQIMEvent; class TQWSDecoration; #endif -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD class TQMutex; class TQThread; -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD class TQApplication; @@ -297,7 +297,7 @@ public: static bool x11_apply_settings(); #endif void wakeUpGuiThread(); -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD void lock(); void unlock(bool wakeUpGui = TRUE); bool locked(); @@ -354,9 +354,9 @@ private slots: #endif public: -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD static TQMutex *tqt_mutex; -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD private: int app_argc; @@ -372,7 +372,7 @@ private: #ifndef TQT_NO_CURSOR static TQCursor *app_cursor; #endif -#ifndef TQT_THREAD_SUPPORT +#if defined(TQT_NO_THREAD) static TQEventLoop* eventloop; #endif static int app_tracking; @@ -436,9 +436,9 @@ private: friend class TQDialog; friend class TQAccelManager; friend class TQEvent; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD friend class TQThread; -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD friend class TQTranslator; friend class TQEventLoop; friend TQ_EXPORT void tqt_ucm_initialize( TQApplication * ); @@ -458,7 +458,7 @@ private: static TQEventLoop* currentEventLoop(); public: -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD static TQThread* guiThread(); static void threadTerminationHandler( TQThread * ); #endif diff --git a/src/kernel/ntqeventloop.h b/src/kernel/ntqeventloop.h index deca8d061..029095253 100644 --- a/src/kernel/ntqeventloop.h +++ b/src/kernel/ntqeventloop.h @@ -59,10 +59,6 @@ struct timeval; //stdc struct struct TimerInfo; //internal structure (qeventloop_mac.cpp) #endif -#if defined(TQT_THREAD_SUPPORT) -class TQMutex; -#endif // TQT_THREAD_SUPPORT - class TQ_EXPORT TQEventLoop : public TQObject { diff --git a/src/kernel/ntqgplugin.h b/src/kernel/ntqgplugin.h index 1b7431458..472a6f17e 100644 --- a/src/kernel/ntqgplugin.h +++ b/src/kernel/ntqgplugin.h @@ -66,7 +66,7 @@ #endif #ifndef TQ_EXPORT_PLUGIN -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD #define QT_THREADED_BUILD 1 #define Q_PLUGIN_FLAGS_STRING "11" #else diff --git a/src/kernel/ntqobject.h b/src/kernel/ntqobject.h index cc5d5c895..484c425c7 100644 --- a/src/kernel/ntqobject.h +++ b/src/kernel/ntqobject.h @@ -64,7 +64,7 @@ class TQObjectUserData; #endif struct TQUObject; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD class TQThread; #endif @@ -230,14 +230,14 @@ private: // Disabled copy constructor and operator= #endif public: -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQThread* contextThreadObject() const; void moveToThread(TQThread *targetThread); void disableThreadPostedEvents(bool disable); #endif private: -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD void moveToThread_helper(TQThread *targetThread); void setThreadObject_helper(TQThread *targetThread); #endif diff --git a/src/kernel/ntqthread.h b/src/kernel/ntqthread.h index 6f72e67c1..7e7b259cf 100644 --- a/src/kernel/ntqthread.h +++ b/src/kernel/ntqthread.h @@ -45,7 +45,7 @@ #include "ntqwindowdefs.h" #endif // QT_H -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD #include <limits.h> @@ -141,6 +141,6 @@ class TQ_EXPORT TQEventLoopThread : public TQThread virtual void run(); }; -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD #endif // TQTHREAD_H diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index fbdb9330c..8f8dade54 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -65,11 +65,11 @@ #endif #include "qfontdata_p.h" -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD # include "ntqmutex.h" # include "ntqthread.h" # include <private/qthreadinstance_p.h> -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD #include <stdlib.h> @@ -375,7 +375,7 @@ TQStringList *TQApplication::app_libpaths = 0; bool TQApplication::metaComposeUnicode = FALSE; int TQApplication::composedUnicode = 0; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutex *TQApplication::tqt_mutex = 0; TQMutex *tqt_sharedStringMutex = 0; TQ_EXPORT TQMutex * tqt_sharedMetaObjectMutex = 0; @@ -388,13 +388,11 @@ TQ_EXPORT TQt::HANDLE tqt_get_application_thread_id() { return tqt_application_thread_id; } -#endif // TQT_THREAD_SUPPORT - -#ifndef TQT_THREAD_SUPPORT +#else // !TQT_NO_THREAD TQEventLoop *TQApplication::eventloop = 0; // application event loop -#endif +#endif // TQT_NO_THREAD -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQEventLoop* TQApplication::currentEventLoop() { TQThread* thread = TQThread::currentThreadObject(); if (thread) { @@ -541,7 +539,7 @@ TQClipboard *tqt_clipboard = 0; // global clipboard object #endif TQWidgetList * tqt_modal_stack=0; // stack of modal widgets -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD // thread wrapper for the main() thread class TQCoreApplicationThread : public TQThread { @@ -603,9 +601,9 @@ static TQPostEventList *globalPostedEvents = 0; // list of posted events uint qGlobalPostedEventsCount() { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( postevent_mutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if (!globalPostedEvents) { return 0; @@ -1033,7 +1031,7 @@ TQApplication::TQApplication(Display *dpy, int argc, char **argv, #endif // TQ_WS_X11 -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQThread* TQApplication::guiThread() { return mainThread(); } @@ -1067,7 +1065,7 @@ void TQApplication::init_precmdline() void TQApplication::initialize( int argc, char **argv, bool enable_sm ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD tqt_mutex = new TQMutex( TRUE ); tqt_sharedStringMutex = new TQMutex( TRUE ); tqt_sharedMetaObjectMutex = new TQMutex( TRUE ); @@ -1076,7 +1074,7 @@ void TQApplication::initialize( int argc, char **argv, bool enable_sm ) #endif // QT_USE_GLIBMAINLOOP postevent_mutex = new TQMutex( TRUE ); tqt_application_thread_id = TQThread::currentThread(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD app_argc = argc; app_argv = argv; @@ -1224,12 +1222,12 @@ TQApplication::~TQApplication() app_libpaths = 0; #endif -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD delete tqt_mutex; tqt_mutex = 0; delete postevent_mutex; postevent_mutex = 0; -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if( tqApp == this ) { if ( postedEvents ) @@ -1252,7 +1250,7 @@ TQApplication::~TQApplication() session_key = 0; #endif //TQT_NO_SESSIONMANAGER -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD delete tqt_sharedMetaObjectMutex; tqt_sharedMetaObjectMutex = 0; delete tqt_sharedStringMutex; @@ -1261,7 +1259,7 @@ TQApplication::~TQApplication() delete tqt_timerListMutex; tqt_timerListMutex = 0; #endif // QT_USE_GLIBMAINLOOP -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD tqt_explicit_app_style = FALSE; tqt_app_has_font = FALSE; @@ -2519,9 +2517,9 @@ bool TQApplication::notify( TQObject *receiver, TQEvent *e ) } if ( e->type() == TQEvent::ChildRemoved && receiver->postedEvents) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( postevent_mutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if (globalPostedEvents) { // the TQObject destructor calls TQObject::removeChild, which calls @@ -2866,7 +2864,7 @@ bool TQApplication::internalNotify( TQObject *receiver, TQEvent * e) } if (!handled) { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD int locklevel = 0; int llcount; if (TQApplication::tqt_mutex) { @@ -2879,7 +2877,7 @@ bool TQApplication::internalNotify( TQObject *receiver, TQEvent * e) } #endif consumed = receiver->event( e ); -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (TQApplication::tqt_mutex) { for (llcount=0; llcount<locklevel; llcount++) { TQApplication::tqt_mutex->lock(); @@ -3031,7 +3029,7 @@ int TQApplication::exec() */ void TQApplication::exit( int retcode ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQThread* thread = tqApp->guiThread(); if (thread) { if (thread->d) { @@ -3042,7 +3040,7 @@ void TQApplication::exit( int retcode ) } #else tqApp->eventLoop()->exit( retcode ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD } /*! @@ -3367,9 +3365,9 @@ void TQApplication::postEvent( TQObject *receiver, TQEvent *event ) return; } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( postevent_mutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if ( !globalPostedEvents ) { // create list globalPostedEvents = new TQPostEventList; @@ -3463,7 +3461,7 @@ void TQApplication::postEvent( TQObject *receiver, TQEvent *event ) l->append( pe ); globalPostedEvents->append( pe ); -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD // Wake up the receiver thread event loop TQThread* thread = receiver->contextThreadObject(); if (thread) { @@ -3516,7 +3514,7 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) sendPostedEvents( 0, TQEvent::ChildInserted ); } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( postevent_mutex ); #endif @@ -3549,7 +3547,7 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) && ( event_type == 0 // we send all types || event_type == pe->event->type() ) // we send THAT type && ( !pe->receiver->wasDeleted ) // don't send if receiver was deleted -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD // only send if active thread is receiver object owning thread && ( pe->receiver->contextThreadObject() == TQThread::currentThreadObject() ) #endif @@ -3579,9 +3577,9 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) } } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if ( locker.mutex() ) locker.mutex()->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD // after all that work, it's time to deliver the event. if ( e->type() == TQEvent::Paint && r->isWidgetType() ) { TQWidget * w = (TQWidget*)r; @@ -3593,9 +3591,9 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) sent = TRUE; TQApplication::sendEvent( r, e ); } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if ( locker.mutex() ) locker.mutex()->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD delete e; // careful when adding anything below this point - the @@ -3654,9 +3652,9 @@ void TQApplication::removePostedEvents( TQObject *receiver, int event_type ) return; } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( postevent_mutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD // the TQObject destructor calls this function directly. this can // happen while the event loop is in the middle of posting events, @@ -3707,9 +3705,9 @@ void TQApplication::removePostedEvent( TQEvent * event ) return; } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( postevent_mutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if ( !globalPostedEvents ) { #if defined(QT_DEBUG) @@ -3804,7 +3802,7 @@ void TQApplication::removePostedEvent( TQEvent * event ) } } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD static void tqThreadTerminationHandlerRecursive( TQObject* object, TQThread* originThread, TQThread* destinationThread ) { TQThread* objectThread = object->contextThreadObject(); if (objectThread && (objectThread == originThread)) { @@ -3845,7 +3843,7 @@ void TQApplication::threadTerminationHandler( TQThread *originThread ) { tqThreadTerminationHandlerRecursive((*objectit), originThread, destinationThread); } } -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD /*!\internal @@ -4196,7 +4194,7 @@ bool TQApplication::desktopSettingsAware() \sa lock(), unlock() \link threads.html Thread Support in TQt\endlink */ -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD void TQApplication::lock() { tqt_mutex->lock(); diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp index f5f2701ad..7eca9b26f 100644 --- a/src/kernel/qapplication_x11.cpp +++ b/src/kernel/qapplication_x11.cpp @@ -87,6 +87,7 @@ #include "ntqsettings.h" #include "ntqstylefactory.h" #include "ntqfileinfo.h" +#include "ntqthread.h" // Input method stuff - UNFINISHED #ifndef TQT_NO_IM @@ -94,9 +95,6 @@ #endif // TQT_NO_IM #include "qinternal_p.h" // shared double buffer cleanup -#if defined(TQT_THREAD_SUPPORT) -# include "ntqthread.h" -#endif #if defined(QT_DEBUG) && defined(Q_OS_LINUX) # include "ntqfile.h" @@ -1657,7 +1655,7 @@ void tqt_init_internal( int *argcptr, char **argv, setlocale( LC_ALL, "" ); // use correct char set mapping setlocale( LC_NUMERIC, "C" ); // make sprintf()/scanf() work -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (( tqt_is_gui_used ) && ( !display )) { // If TQt is running standalone with a GUI, initialize X11 threading XInitThreads(); @@ -2220,7 +2218,7 @@ void tqt_init_internal( int *argcptr, char **argv, TQPainter::initialize(); } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD TQThread::initialize(); #endif @@ -2508,7 +2506,7 @@ void tqt_cleanup() TQColor::cleanup(); TQSharedDoubleBuffer::cleanup(); } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD TQThread::cleanup(); #endif diff --git a/src/kernel/qeventloop.cpp b/src/kernel/qeventloop.cpp index 402894f2a..c72c9f2bf 100644 --- a/src/kernel/qeventloop.cpp +++ b/src/kernel/qeventloop.cpp @@ -41,7 +41,7 @@ #include "ntqapplication.h" #include "ntqdatetime.h" -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD # include "ntqthread.h" # include "private/qthreadinstance_p.h" #endif @@ -107,18 +107,18 @@ TQEventLoop::TQEventLoop( TQObject *parent, const char *name ) #if defined(QT_CHECK_STATE) if ( TQApplication::currentEventLoop() ) tqFatal( "TQEventLoop: there must be only one event loop object per thread. \nIf this is supposed to be the main GUI event loop, construct it before TQApplication." ); -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (!TQThread::currentThreadObject()) { tqFatal( "TQEventLoop: this object can only be used in threads constructed via TQThread." ); } -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD #endif // QT_CHECK_STATE d = new TQEventLoopPrivate; init(); -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQThread* thread = TQThread::currentThreadObject(); if (thread) { if (thread->d) { @@ -137,7 +137,7 @@ TQEventLoop::~TQEventLoop() { cleanup(); delete d; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQThread* thread = TQThread::currentThreadObject(); if (thread) { if (thread->d) { diff --git a/src/kernel/qeventloop_unix_glib.cpp b/src/kernel/qeventloop_unix_glib.cpp index f84339651..e4490f388 100644 --- a/src/kernel/qeventloop_unix_glib.cpp +++ b/src/kernel/qeventloop_unix_glib.cpp @@ -45,21 +45,18 @@ #include "ntqapplication.h" #include "ntqbitarray.h" #include "ntqmutex.h" - -#if defined(TQT_THREAD_SUPPORT) - #include "ntqthread.h" -#endif +#include "ntqthread.h" #include <stdlib.h> #include <sys/types.h> #include <glib.h> -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD #ifdef QT_USE_GLIBMAINLOOP extern TQMutex *tqt_timerListMutex; #endif // QT_USE_GLIBMAINLOOP -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD /***************************************************************************** Timer handling; UNIX has no application timer support so we'll have to @@ -186,7 +183,7 @@ static int allocTimerId() // find avail timer identifier static void insertTimer( const TimerInfo *ti ) // insert timer info into list { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex->lock(); #endif TimerInfo *t = timerList->first(); @@ -209,7 +206,7 @@ static void insertTimer( const TimerInfo *ti ) // insert timer info into list tqDebug( "TQObject: %d timers now exist for object %s::%s", dangerCount, ti->obj->className(), ti->obj->name() ); } #endif -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex->unlock(); #endif } @@ -235,7 +232,7 @@ static inline void getTime( timeval &t ) // get time of day static void repairTimer( const timeval &time ) // repair broken timer { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex->lock(); #endif timeval diff = watchtime - time; @@ -244,7 +241,7 @@ static void repairTimer( const timeval &time ) // repair broken timer t->timeout = t->timeout - diff; t = timerList->next(); } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex->unlock(); #endif } @@ -262,7 +259,7 @@ static void repairTimer( const timeval &time ) // repair broken timer timeval *qt_wait_timer() { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex->lock(); #endif static timeval tm; @@ -288,19 +285,19 @@ timeval *qt_wait_timer() if ( qt_wait_timer_max && *qt_wait_timer_max < tm ) { tm = *qt_wait_timer_max; } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex->unlock(); #endif return &tm; } if ( qt_wait_timer_max ) { tm = *qt_wait_timer_max; -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex->unlock(); #endif return &tm; } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex->unlock(); #endif return 0; // no timers @@ -316,7 +313,7 @@ static void initTimers() // initialize timers timerBitVec->clearBit( i ); } timerList = new TimerList; -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD tqt_timerListMutex = new TQMutex(true); #endif TQ_CHECK_PTR( timerList ); @@ -336,18 +333,18 @@ void cleanupTimers() // Main timer functions for starting and killing timers int qStartTimer( int interval, TQObject *obj ) { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->lock(); #endif if ( !timerList ) { // initialize timer data initTimers(); -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->lock(); #endif } int id = allocTimerId(); // get free timer id if ( (id <= 0) || (id > (int)timerBitVec->size()) || (!obj) ) { // cannot create timer -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return 0; @@ -363,7 +360,7 @@ int qStartTimer( int interval, TQObject *obj ) t->timeout = currentTime + t->interval; t->obj = obj; insertTimer( t ); // put timer in list -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return id; @@ -371,12 +368,12 @@ int qStartTimer( int interval, TQObject *obj ) bool qKillTimer( int id ) { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->lock(); #endif TimerInfo *t; if ( (!timerList) || (id <= 0) || (id > (int)timerBitVec->size()) || (!timerBitVec->testBit( id-1 )) ) { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return FALSE; // not init'd or invalid timer @@ -389,13 +386,13 @@ bool qKillTimer( int id ) bool ret; timerBitVec->clearBit( id-1 ); // set timer inactive ret = timerList->remove(); -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return ret; } else { // id not found -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return FALSE; @@ -404,12 +401,12 @@ bool qKillTimer( int id ) bool qKillTimer( TQObject *obj ) { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->lock(); #endif TimerInfo *t; if ( !timerList ) { // not initialized -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return FALSE; @@ -425,7 +422,7 @@ bool qKillTimer( TQObject *obj ) t = timerList->next(); } } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return TRUE; @@ -632,11 +629,11 @@ int TQEventLoop::timeToWait() const int TQEventLoop::activateTimers() { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->lock(); #endif if ( !timerList || !timerList->count() ) { // no timers -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return 0; @@ -682,11 +679,10 @@ int TQEventLoop::activateTimers() if ( t->interval.tv_usec > 0 || t->interval.tv_sec > 0 ) { n_act++; } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); -#endif + TQTimerEvent e( t->id ); -#if defined(TQT_THREAD_SUPPORT) // Be careful...the current thread may not be the target object's thread! if ((!t->obj) || (TQThread::currentThreadObject() && TQThread::currentThreadObject()->threadPostedEventsDisabled()) || @@ -696,17 +692,15 @@ int TQEventLoop::activateTimers() else { TQApplication::postEvent( t->obj, new TQTimerEvent(e) ); // post event to correct thread } -#else // defined(TQT_THREAD_SUPPORT) - TQApplication::sendEvent( t->obj, &e ); // send event -#endif // defined(TQT_THREAD_SUPPORT) -#if defined(TQT_THREAD_SUPPORT) if (tqt_timerListMutex) tqt_timerListMutex->lock(); -#endif +#else // !TQT_NO_THREAD + TQApplication::sendEvent( t->obj, &e ); // send event +#endif // TQT_NO_THREAD if ( timerList->findRef( begin ) == -1 ) { begin = 0; } } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (tqt_timerListMutex) tqt_timerListMutex->unlock(); #endif return n_act; @@ -731,7 +725,7 @@ int TQEventLoop::activateSocketNotifiers() printf("activate sn : send event fd=%d\n", sn->gPollFD.fd ); #endif sn->pending = FALSE; -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD // Be careful...the current thread may not be the target object's thread! if ((!sn->obj) || (TQThread::currentThreadObject() && TQThread::currentThreadObject()->threadPostedEventsDisabled()) || @@ -741,9 +735,9 @@ int TQEventLoop::activateSocketNotifiers() else { TQApplication::postEvent( sn->obj, new TQEvent(event) ); // post event to correct thread } -#else // defined(TQT_THREAD_SUPPORT) +#else // !TQT_NO_THREAD TQApplication::sendEvent( sn->obj, &event ); // send event -#endif // defined(TQT_THREAD_SUPPORT) +#endif // TQT_NO_THREAD n_act++; } } diff --git a/src/kernel/qeventloop_x11.cpp b/src/kernel/qeventloop_x11.cpp index 1ba3b21df..a20acb6a5 100644 --- a/src/kernel/qeventloop_x11.cpp +++ b/src/kernel/qeventloop_x11.cpp @@ -40,12 +40,10 @@ #include "ntqeventloop.h" #include "ntqapplication.h" #include "ntqbitarray.h" +#include "ntqmutex.h" #include "qcolor_p.h" #include "qt_x11_p.h" -#if defined(TQT_THREAD_SUPPORT) -# include "ntqmutex.h" -#endif // TQT_THREAD_SUPPORT #include <errno.h> @@ -138,7 +136,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) XEvent event; int nevents = 0; -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD TQMutexLocker locker( TQApplication::tqt_mutex ); #endif @@ -283,7 +281,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) // unlock the GUI mutex and select. when we return from this function, there is // something for us to do -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if ( locker.mutex() ) locker.mutex()->unlock(); else return false; #endif @@ -298,7 +296,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) } while (nsel == -1 && (errno == EINTR || errno == EAGAIN)); // relock the GUI mutex before processing any pending events -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if ( locker.mutex() ) locker.mutex()->lock(); else return false; #endif diff --git a/src/kernel/qeventloop_x11_glib.cpp b/src/kernel/qeventloop_x11_glib.cpp index 4b44fe8f2..20d72dba5 100644 --- a/src/kernel/qeventloop_x11_glib.cpp +++ b/src/kernel/qeventloop_x11_glib.cpp @@ -43,14 +43,11 @@ #include "ntqeventloop.h" #include "ntqapplication.h" #include "ntqbitarray.h" +#include "ntqmutex.h" +#include "ntqthread.h" #include "qcolor_p.h" #include "qt_x11_p.h" -#if defined(TQT_THREAD_SUPPORT) -# include "ntqmutex.h" -# include "ntqthread.h" -#endif // TQT_THREAD_SUPPORT - #include <errno.h> #include <glib.h> @@ -295,7 +292,7 @@ bool TQEventLoop::processX11Events() XEvent event; int nevents = 0; -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD TQMutexLocker locker( TQApplication::tqt_mutex ); #endif @@ -383,7 +380,7 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) ProcessEventsFlags flags = d->pev_flags; -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD TQMutexLocker locker( TQApplication::tqt_mutex ); #endif @@ -535,10 +532,8 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) { Q_UNUSED(gs); // relock the GUI mutex before processing any pending events -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD TQMutexLocker locker( TQApplication::tqt_mutex ); -#endif -#if defined(TQT_THREAD_SUPPORT) if (locker.mutex()) locker.mutex()->lock(); #endif @@ -608,13 +603,13 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) { // color approx. optimization - only on X11 qt_reset_color_avail(); -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (locker.mutex()) locker.mutex()->unlock(); #endif processX11Events(); } else { -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD if (locker.mutex()) locker.mutex()->unlock(); #endif } @@ -629,9 +624,9 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) { bool TQEventLoop::hasPendingEvents() const { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( TQApplication::tqt_mutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD extern uint qGlobalPostedEventsCount(); // from qapplication.cpp return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isGuiThread()) ? XPending( TQPaintDevice::x11AppDisplay() ) : 0)); diff --git a/src/kernel/qfont_x11.cpp b/src/kernel/qfont_x11.cpp index 9f86734a4..7828315fd 100644 --- a/src/kernel/qfont_x11.cpp +++ b/src/kernel/qfont_x11.cpp @@ -269,13 +269,13 @@ void TQFont::initialize() TQString sample; if ( ttmp != -1 ) { -#if defined(TQT_THREAD_SUPPORT) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) +#if !defined(TQT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant versions of localtime() where available tm res; tt = localtime_r( &ttmp, &res ); #else tt = localtime( &ttmp ); -#endif // TQT_THREAD_SUPPORT && _POSIX_THREAD_SAFE_FUNCTIONS +#endif // !TQT_NO_THREAD && _POSIX_THREAD_SAFE_FUNCTIONS if ( tt != 0 && strftime( samp, 64, "%A%B", tt ) > 0 ) if ( codec ) diff --git a/src/kernel/qmetaobject.cpp b/src/kernel/qmetaobject.cpp index 70ed6b5d5..e752ad8e8 100644 --- a/src/kernel/qmetaobject.cpp +++ b/src/kernel/qmetaobject.cpp @@ -41,9 +41,9 @@ #include "ntqmetaobject.h" #include "ntqasciidict.h" -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD #include <private/qmutexpool_p.h> -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD /*! \class TQMetaData ntqmetaobject.h @@ -282,10 +282,10 @@ TQMetaObject::~TQMetaObject() delete slotDict; // delete dicts delete signalDict; delete d; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker( tqt_global_mutexpool ? tqt_global_mutexpool->get( &qt_metaobjects ) : 0 ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if ( qt_metaobjects ) { qt_metaobjects->remove( classname ); if ( qt_metaobjects->isEmpty() ) { @@ -799,10 +799,10 @@ TQMetaObject *TQMetaObject::metaObject( const char *class_name ) { if ( !qt_metaobjects ) return 0; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker( tqt_global_mutexpool ? tqt_global_mutexpool->get( &qt_metaobjects ) : 0 ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD TQtStaticMetaObjectFunction func = (TQtStaticMetaObjectFunction)qt_metaobjects->find( class_name ); if ( func ) return func(); @@ -814,10 +814,10 @@ bool TQMetaObject::hasMetaObject( const char *class_name ) { if ( !qt_metaobjects ) return FALSE; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker( tqt_global_mutexpool ? tqt_global_mutexpool->get( &qt_metaobjects ) : 0 ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD return !!qt_metaobjects->find( class_name ); } @@ -1204,10 +1204,10 @@ bool TQMetaProperty::reset( TQObject* o ) const TQMetaObjectCleanUp::TQMetaObjectCleanUp( const char *mo_name, TQtStaticMetaObjectFunction func ) : metaObject( 0 ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker( tqt_global_mutexpool ? tqt_global_mutexpool->get( &qt_metaobjects ) : 0 ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if ( !qt_metaobjects ) qt_metaobjects = new TQAsciiDict<void>( 257 ); qt_metaobjects->insert( mo_name, (void*)func ); @@ -1226,10 +1226,10 @@ TQMetaObjectCleanUp::TQMetaObjectCleanUp() TQMetaObjectCleanUp::~TQMetaObjectCleanUp() { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker( tqt_global_mutexpool ? tqt_global_mutexpool->get( &qt_metaobjects ) : 0 ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if ( !--qt_metaobjects_count ) { delete qt_metaobjects; qt_metaobjects = 0; diff --git a/src/kernel/qobject.cpp b/src/kernel/qobject.cpp index 1e6d55836..09a2b6031 100644 --- a/src/kernel/qobject.cpp +++ b/src/kernel/qobject.cpp @@ -52,7 +52,7 @@ // TQStyleControlElementData #include "ntqstyle.h" -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD #include "ntqmutex.h" #include <private/qmutexpool_p.h> #include "ntqthread.h" @@ -105,7 +105,7 @@ class TQObjectPrivate { public: #ifndef TQT_NO_USERDATA TQObjectPrivate( uint s ) : TQPtrVector<TQObjectUserData>(s) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD ownThread = NULL; disableThreadPostedEvents = false; #endif @@ -118,7 +118,7 @@ public: delete controlElementDataPrivate; } #endif -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQThread* ownThread; TQMutex* senderObjectListMutex; TQMutex* childObjectListMutex; @@ -142,16 +142,14 @@ TQStyleControlElementDataPrivate* TQObject::controlElementDataPrivateObject() { return d->controlElementDataPrivate; } -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD void TQObject::moveToThread_helper(TQThread *targetThread) { TQEvent e(TQEvent::ThreadChange); TQApplication::sendEvent(this, &e); -#ifdef TQT_THREAD_SUPPORT TQMutexLocker locker( d->childObjectListMutex ); -#endif // TQT_THREAD_SUPPORT if (childObjects) { TQObject *child; @@ -167,9 +165,7 @@ void TQObject::setThreadObject_helper(TQThread *targetThread) { d->ownThread = targetThread; -#ifdef TQT_THREAD_SUPPORT TQMutexLocker locker( d->childObjectListMutex ); -#endif // TQT_THREAD_SUPPORT if (childObjects) { TQObject *child; @@ -197,9 +193,7 @@ void TQObject::setThreadObject_helper(TQThread *targetThread) */ void TQObject::moveToThread(TQThread *targetThread) { -#ifdef TQT_THREAD_SUPPORT TQMutexLocker locker( TQApplication::tqt_mutex ); -#endif // TQT_THREAD_SUPPORT if (parentObj) { #if defined(QT_DEBUG) @@ -252,7 +246,7 @@ void TQObject::disableThreadPostedEvents(bool disable) { d->disableThreadPostedEvents = disable; } -#endif // defined(TQT_THREAD_SUPPORT) +#endif // TQT_NO_THREAD) class TQSenderObjectList : public TQObjectList, public TQShared { @@ -262,19 +256,19 @@ class TQSenderObjectList : public TQObjectList, public TQShared public: TQObject *currentSender; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutex *listMutex; #endif }; TQSenderObjectList::TQSenderObjectList() : currentSender( 0 ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD listMutex = new TQMutex( TRUE ); #endif } TQSenderObjectList::~TQSenderObjectList() { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD delete listMutex; #endif } @@ -509,7 +503,7 @@ void *tqt_find_obj_child( TQObject *parent, const char *type, const char *name ) return 0; } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD /*! Returns a pointer to the TQThread* associated with @@ -548,12 +542,12 @@ static void qt_spy_signal( TQObject* sender, int signal, TQUObject* o ) s.sprintf( "%s_%s", mo->className(), sigData->name ); int slot = tqt_preliminary_signal_spy->metaObject()->findSlot( s, TRUE ); if ( slot >= 0 ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD // protect access to qt_spy_signal_sender void * const address = &qt_spy_signal_sender; TQMutexLocker locker( tqt_global_mutexpool ? tqt_global_mutexpool->get( address ) : 0 ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD TQObject* old_sender = qt_spy_signal_sender; qt_spy_signal_sender = sender; @@ -572,7 +566,7 @@ static void qt_spy_signal( TQObject* sender, int signal, TQUObject* o ) static TQObjectList* object_trees = 0; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD static TQMutex *obj_trees_mutex = 0; #endif @@ -580,7 +574,7 @@ static void cleanup_object_trees() { delete object_trees; object_trees = 0; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD delete obj_trees_mutex; obj_trees_mutex = 0; #endif @@ -594,7 +588,7 @@ static void ensure_object_trees() static void insert_tree( TQObject* obj ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if ( !obj_trees_mutex ) obj_trees_mutex = new TQMutex(); TQMutexLocker locker( obj_trees_mutex ); @@ -607,7 +601,7 @@ static void insert_tree( TQObject* obj ) static void remove_tree( TQObject* obj ) { if ( object_trees ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( obj_trees_mutex ); #endif object_trees->removeRef( obj ); @@ -685,7 +679,7 @@ TQObject::TQObject( TQObject *parent, const char *name ) d = new TQObjectPrivate(0); } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD d->ownThread = TQThread::currentThreadObject(); d->senderObjectListMutex = new TQMutex( TRUE ); d->childObjectListMutex = new TQMutex( TRUE ); @@ -777,7 +771,7 @@ TQObject::~TQObject() while( (c=cit.current()) ) { // for each connected slot... ++cit; if ( (obj=c->object()) ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQ_NO_THREAD TQMutexLocker locker( obj->senderObjects->listMutex ); #endif removeObjFromList( obj->senderObjects, this ); @@ -804,10 +798,10 @@ TQObject::~TQObject() delete childObjects; } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD delete d->childObjectListMutex; delete d->senderObjectListMutex; -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD delete d; } @@ -1099,25 +1093,25 @@ bool TQObject::event( TQEvent *e ) { TQMetaCallEvent* metaEvent = dynamic_cast<TQMetaCallEvent*>(e); if (metaEvent) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if ((d->disableThreadPostedEvents) || (d->ownThread == TQThread::currentThreadObject())) -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD { TQSenderObjectList* sol; TQObject* oldSender = 0; sol = senderObjects; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if ( sol ) { oldSender = sol->currentSender; sol->ref(); sol->currentSender = metaEvent->sender(); } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD TQUObject *o = metaEvent->data(); if (metaEvent->type() == TQMetaCallEvent::MetaCallEmit) { tqt_emit( metaEvent->id(), o ); @@ -1125,28 +1119,28 @@ bool TQObject::event( TQEvent *e ) if (metaEvent->type() == TQMetaCallEvent::MetaCallInvoke) { tqt_invoke( metaEvent->id(), o ); } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if (sol ) { sol->currentSender = oldSender; if ( sol->deref() ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD delete sol; sol = NULL; } } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (sol) sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD else { tqWarning("TQObject: Ignoring metacall event from non-owning thread"); } -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD destroyDeepCopiedTQUObjectArray(metaEvent->data()); } } @@ -1648,9 +1642,9 @@ TQConnectionList *TQObject::receivers( int signal ) const void TQObject::insertChild( TQObject *obj ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( d->childObjectListMutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if ( obj->isTree ) { remove_tree( obj ); @@ -1694,9 +1688,9 @@ void TQObject::insertChild( TQObject *obj ) void TQObject::removeChild( TQObject *obj ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( d->childObjectListMutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD if ( childObjects && childObjects->removeRef(obj) ) { obj->parentObj = 0; @@ -1934,12 +1928,12 @@ const TQObject *TQObject::sender() { #ifndef TQT_NO_PRELIMINARY_SIGNAL_SPY if ( this == tqt_preliminary_signal_spy ) { -# ifdef TQT_THREAD_SUPPORT +# ifndef TQT_NO_THREAD // protect access to qt_spy_signal_sender void * const address = &qt_spy_signal_sender; TQMutexLocker locker( tqt_global_mutexpool ? tqt_global_mutexpool->get( address ) : 0 ); -# endif // TQT_THREAD_SUPPORT +# endif // TQT_NO_THREAD return qt_spy_signal_sender; } #endif @@ -2282,24 +2276,24 @@ void TQObject::connectInternal( const TQObject *sender, int signal_index, const TQ_CHECK_PTR( c ); clist->append( c ); if ( !r->senderObjects ) { // create list of senders -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD r->d->senderObjectListMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD r->senderObjects = new TQSenderObjectList; -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD r->senderObjects->listMutex->lock(); r->d->senderObjectListMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD } else { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD r->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD } r->senderObjects->append( s ); // add sender to list -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD r->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD } @@ -2505,25 +2499,25 @@ bool TQObject::disconnectInternal( const TQObject *sender, int signal_index, c = clist->first(); while ( c ) { // for all receivers... if ( r == 0 ) { // remove all receivers -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD removeObjFromList( c->object()->senderObjects, s ); -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD success = TRUE; c = clist->next(); } else if ( r == c->object() && ( (member_index == -1) || ((member_index == c->member()) && (c->memberType() == membcode)) ) ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD removeObjFromList( c->object()->senderObjects, s, TRUE ); -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD success = TRUE; clist->remove(); c = clist->current(); @@ -2542,25 +2536,25 @@ bool TQObject::disconnectInternal( const TQObject *sender, int signal_index, c = clist->first(); while ( c ) { // for all receivers... if ( r == 0 ) { // remove all receivers -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD removeObjFromList( c->object()->senderObjects, s, TRUE ); -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD success = TRUE; c = clist->next(); } else if ( r == c->object() && ( (member_index == -1) || ((member_index == c->member()) && (c->memberType() == membcode)) ) ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD removeObjFromList( c->object()->senderObjects, s, TRUE ); -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD success = TRUE; clist->remove(); c = clist->current(); @@ -2791,10 +2785,10 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) } #endif -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD // NOTE currentThread could be NULL if the current thread was not started using the TQThread API const TQThread *currentThread = TQThread::currentThreadObject(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD // Some slots are deleting the sender. It's not that great, but it's widespread enough, // so we can't track all such issues. So, we have to workaround this somehow. @@ -2813,15 +2807,15 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) TQObject *oldSender; TQSenderObjectList* sol = object->senderObjects; if ( sol ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD oldSender = sol->currentSender; sol->ref(); sol->currentSender = this; } if ( c->memberType() == TQ_SIGNAL_CODE ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if ((d->disableThreadPostedEvents) || (object->d->disableThreadPostedEvents) || (currentThread && currentThread->threadPostedEventsDisabled()) || @@ -2839,12 +2833,12 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) TQApplication::postEvent(object, new TQMetaCallEvent(c->member(), this, deepCopyTQUObjectArray(o), TQMetaCallEvent::MetaCallEmit)); } } -#else // !TQT_THREAD_SUPPORT +#else // !TQT_NO_THREAD object->tqt_emit( c->member(), o ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD } else { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if ((d->disableThreadPostedEvents) || (object->d->disableThreadPostedEvents) || (currentThread && currentThread->threadPostedEventsDisabled()) || @@ -2862,23 +2856,23 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) TQApplication::postEvent(object, new TQMetaCallEvent(c->member(), this, deepCopyTQUObjectArray(o), TQMetaCallEvent::MetaCallInvoke)); } } -#else // !TQT_THREAD_SUPPORT +#else // !TQT_NO_THREAD object->tqt_invoke( c->member(), o ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD } if ( sol ) { sol->currentSender = oldSender; if ( sol->deref() ) { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD delete sol; sol = NULL; } } -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD if (sol) sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD } // use a copy of the pointer here as at this point this might be already deleted; no pun intended ;) @@ -3021,9 +3015,9 @@ void TQObject::dumpObjectTree() void TQObject::dumpObjectInfo() { -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD TQMutexLocker locker( d->senderObjectListMutex ); -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD #if defined(QT_DEBUG) tqDebug( "OBJECT %s::%s", className(), name( "unnamed" ) ); diff --git a/src/kernel/qthread.cpp b/src/kernel/qthread.cpp index 185921c70..dd8091137 100644 --- a/src/kernel/qthread.cpp +++ b/src/kernel/qthread.cpp @@ -38,7 +38,7 @@ #include "ntqglobal.h" -#ifdef TQT_THREAD_SUPPORT +#ifndef TQT_NO_THREAD #include "qplatformdefs.h" @@ -130,9 +130,7 @@ TQThread::TQThread() { -#ifdef TQT_THREAD_SUPPORT TQMutexLocker locker( TQApplication::tqt_mutex ); -#endif // TQT_THREAD_SUPPORT d = new TQThreadInstance; d->init(0); @@ -270,4 +268,4 @@ void TQEventLoopThread::run() if (eventLoop) eventLoop->exec(); } -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD diff --git a/src/kernel/qthread_unix.cpp b/src/kernel/qthread_unix.cpp index 501471fec..045c7f1d7 100644 --- a/src/kernel/qthread_unix.cpp +++ b/src/kernel/qthread_unix.cpp @@ -38,7 +38,7 @@ #include "ntqglobal.h" -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD #include "qplatformdefs.h" @@ -563,4 +563,4 @@ TQThread *TQThread::currentThreadObject() } -#endif // TQT_THREAD_SUPPORT +#endif // TQT_NO_THREAD diff --git a/src/kernel/qwidget.cpp b/src/kernel/qwidget.cpp index 1af274c6e..13d92151d 100644 --- a/src/kernel/qwidget.cpp +++ b/src/kernel/qwidget.cpp @@ -56,7 +56,7 @@ #include "ntqstyle.h" #include "ntqmetaobject.h" #include "ntqguardedptr.h" -#if defined(TQT_THREAD_SUPPORT) +#ifndef TQT_NO_THREAD #include "ntqthread.h" #endif #if defined(QT_ACCESSIBILITY_SUPPORT) @@ -890,7 +890,7 @@ TQWidget::TQWidget( TQWidget *parent, const char *name, WFlags f, NFlags n ) } #endif -#if defined(TQT_THREAD_SUPPORT) && defined(QT_CHECK_STATE) +#if !defined(TQT_NO_THREAD) && defined(QT_CHECK_STATE) if (TQThread::currentThreadObject() != TQApplication::guiThread()) { tqFatal( "TQWidget: Cannot create a TQWidget outside of the main GUI thread" ); } |
