diff options
Diffstat (limited to 'src/kernel/qeventloop_unix_glib.cpp')
-rw-r--r-- | src/kernel/qeventloop_unix_glib.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/kernel/qeventloop_unix_glib.cpp b/src/kernel/qeventloop_unix_glib.cpp index a71807a..c41acce 100644 --- a/src/kernel/qeventloop_unix_glib.cpp +++ b/src/kernel/qeventloop_unix_glib.cpp @@ -46,7 +46,7 @@ #include "qbitarray.h" #include "qmutex.h" -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) #include "qthread.h" #endif @@ -55,11 +55,11 @@ #include <glib.h> -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT #ifdef QT_USE_GLIBMAINLOOP extern QMutex *qt_timerListMutex; #endif // QT_USE_GLIBMAINLOOP -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT /***************************************************************************** Timer handling; UNIX has no application timer support so we'll have to @@ -186,7 +186,7 @@ static int allocTimerId() // find avail timer identifier static void insertTimer( const TimerInfo *ti ) // insert timer info into list { -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex->lock(); #endif TimerInfo *t = timerList->first(); @@ -209,7 +209,7 @@ static void insertTimer( const TimerInfo *ti ) // insert timer info into list qDebug( "QObject: %d timers now exist for object %s::%s", dangerCount, ti->obj->className(), ti->obj->name() ); } #endif -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex->unlock(); #endif } @@ -235,7 +235,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) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex->lock(); #endif timeval diff = watchtime - time; @@ -244,7 +244,7 @@ static void repairTimer( const timeval &time ) // repair broken timer t->timeout = t->timeout - diff; t = timerList->next(); } -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex->unlock(); #endif } @@ -262,7 +262,7 @@ static void repairTimer( const timeval &time ) // repair broken timer timeval *qt_wait_timer() { -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex->lock(); #endif static timeval tm; @@ -288,19 +288,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) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex->unlock(); #endif return &tm; } if ( qt_wait_timer_max ) { tm = *qt_wait_timer_max; -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex->unlock(); #endif return &tm; } -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex->unlock(); #endif return 0; // no timers @@ -316,7 +316,7 @@ static void initTimers() // initialize timers timerBitVec->clearBit( i ); } timerList = new TimerList; -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) qt_timerListMutex = new QMutex(true); #endif Q_CHECK_PTR( timerList ); @@ -336,18 +336,18 @@ void cleanupTimers() // Main timer functions for starting and killing timers int qStartTimer( int interval, QObject *obj ) { -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->lock(); #endif if ( !timerList ) { // initialize timer data initTimers(); -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_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) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return 0; @@ -363,7 +363,7 @@ int qStartTimer( int interval, QObject *obj ) t->timeout = currentTime + t->interval; t->obj = obj; insertTimer( t ); // put timer in list -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return id; @@ -371,12 +371,12 @@ int qStartTimer( int interval, QObject *obj ) bool qKillTimer( int id ) { -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->lock(); #endif register TimerInfo *t; if ( (!timerList) || (id <= 0) || (id > (int)timerBitVec->size()) || (!timerBitVec->testBit( id-1 )) ) { -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return FALSE; // not init'd or invalid timer @@ -389,13 +389,13 @@ bool qKillTimer( int id ) bool ret; timerBitVec->clearBit( id-1 ); // set timer inactive ret = timerList->remove(); -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return ret; } else { // id not found -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return FALSE; @@ -404,12 +404,12 @@ bool qKillTimer( int id ) bool qKillTimer( QObject *obj ) { -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->lock(); #endif register TimerInfo *t; if ( !timerList ) { // not initialized -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return FALSE; @@ -425,7 +425,7 @@ bool qKillTimer( QObject *obj ) t = timerList->next(); } } -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return TRUE; @@ -632,11 +632,11 @@ int QEventLoop::timeToWait() const int QEventLoop::activateTimers() { -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->lock(); #endif if ( !timerList || !timerList->count() ) { // no timers -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return 0; @@ -682,11 +682,11 @@ int QEventLoop::activateTimers() if ( t->interval.tv_usec > 0 || t->interval.tv_sec > 0 ) { n_act++; } -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif QTimerEvent e( t->id ); -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) // Be careful...the current thread may not be the target object's thread! if ((!t->obj) || (QThread::currentThreadObject() && QThread::currentThreadObject()->threadPostedEventsDisabled()) || @@ -696,17 +696,17 @@ int QEventLoop::activateTimers() else { QApplication::postEvent( t->obj, new QTimerEvent(e) ); // post event to correct thread } -#else // defined(TQT_THREAD_SUPPORT) +#else // defined(QT_THREAD_SUPPORT) QApplication::sendEvent( t->obj, &e ); // send event -#endif // defined(TQT_THREAD_SUPPORT) -#if defined(TQT_THREAD_SUPPORT) +#endif // defined(QT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->lock(); #endif if ( timerList->findRef( begin ) == -1 ) { begin = 0; } } -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) if (qt_timerListMutex) qt_timerListMutex->unlock(); #endif return n_act; @@ -731,7 +731,7 @@ int QEventLoop::activateSocketNotifiers() printf("activate sn : send event fd=%d\n", sn->gPollFD.fd ); #endif sn->pending = FALSE; -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) // Be careful...the current thread may not be the target object's thread! if ((!sn->obj) || (QThread::currentThreadObject() && QThread::currentThreadObject()->threadPostedEventsDisabled()) || @@ -741,9 +741,9 @@ int QEventLoop::activateSocketNotifiers() else { QApplication::postEvent( sn->obj, new QEvent(event) ); // post event to correct thread } -#else // defined(TQT_THREAD_SUPPORT) +#else // defined(QT_THREAD_SUPPORT) QApplication::sendEvent( sn->obj, &event ); // send event -#endif // defined(TQT_THREAD_SUPPORT) +#endif // defined(QT_THREAD_SUPPORT) n_act++; } } |