@ -99,7 +99,7 @@ static void kvi_threadIgnoreSigalarm()
ignr_act . sa_flags | = SA_RESTART ;
# endif
if ( sigaction ( SIGALRM , & ignr_act , 0 ) = = - 1 ) d ebug( " Failed to set SIG_IGN for SIGALRM. " ) ;
if ( sigaction ( SIGALRM , & ignr_act , 0 ) = = - 1 ) tqD ebug( " Failed to set SIG_IGN for SIGALRM. " ) ;
# endif
# endif
}
@ -108,7 +108,7 @@ static void kvi_threadIgnoreSigalarm()
static void kvi_threadSigpipeHandler ( int )
{
d ebug( " Thread ????: Caught SIGPIPE: ignoring. " ) ;
tqD ebug( " Thread ????: Caught SIGPIPE: ignoring. " ) ;
}
# endif
@ -133,7 +133,7 @@ static void kvi_threadCatchSigpipe()
act . sa_flags | = SA_RESTART ;
# endif
if ( sigaction ( SIGPIPE , & act , 0L ) = = - 1 ) d ebug( " Failed to set the handler for SIGPIPE. " ) ;
if ( sigaction ( SIGPIPE , & act , 0L ) = = - 1 ) tqD ebug( " Failed to set the handler for SIGPIPE. " ) ;
# endif
}
@ -171,7 +171,7 @@ void KviThreadManager::globalDestroy()
KviThreadManager : : KviThreadManager ( )
: TQObject ( )
{
if ( g_pThreadManager ) d ebug( " Hey...what are ya doing ? " ) ;
if ( g_pThreadManager ) tqD ebug( " Hey...what are ya doing ? " ) ;
m_pMutex = new KviMutex ( ) ;
@ -189,17 +189,17 @@ KviThreadManager::KviThreadManager()
if ( pipe ( m_fd ) ! = 0 )
{
d ebug( " Ops...thread manager pipe creation failed (%s) " , KviTQString : : toUtf8 ( KviError : : getDescription ( KviError : : translateSystemError ( errno ) ) ) . data ( ) ) ;
tqD ebug( " Ops...thread manager pipe creation failed (%s) " , KviTQString : : toUtf8 ( KviError : : getDescription ( KviError : : translateSystemError ( errno ) ) ) . data ( ) ) ;
}
if ( fcntl ( m_fd [ KVI_THREAD_PIPE_SIDE_SLAVE ] , F_SETFL , O_NONBLOCK ) = = - 1 )
{
d ebug( " Ops...thread manager slave pipe initialisation failed (%s) " , KviTQString : : toUtf8 ( KviError : : getDescription ( KviError : : translateSystemError ( errno ) ) ) . data ( ) ) ;
tqD ebug( " Ops...thread manager slave pipe initialisation failed (%s) " , KviTQString : : toUtf8 ( KviError : : getDescription ( KviError : : translateSystemError ( errno ) ) ) . data ( ) ) ;
}
if ( fcntl ( m_fd [ KVI_THREAD_PIPE_SIDE_MASTER ] , F_SETFL , O_NONBLOCK ) = = - 1 )
{
d ebug( " Ops...thread manager master pipe initialisation failed (%s) " , KviTQString : : toUtf8 ( KviError : : getDescription ( KviError : : translateSystemError ( errno ) ) ) . data ( ) ) ;
tqD ebug( " Ops...thread manager master pipe initialisation failed (%s) " , KviTQString : : toUtf8 ( KviError : : getDescription ( KviError : : translateSystemError ( errno ) ) ) . data ( ) ) ;
}
m_pSn = new TQSocketNotifier ( m_fd [ KVI_THREAD_PIPE_SIDE_MASTER ] , TQSocketNotifier : : Read ) ;
@ -349,7 +349,7 @@ void KviThreadManager::postSlaveEvent(TQObject *o,TQEvent *e)
{
// ops.. failed to write down the event..
// this is quite irritating now...
d ebug( " Ops.. failed to write down the trigger " ) ;
tqD ebug( " Ops.. failed to write down the trigger " ) ;
// FIXME: maybe a single shot timer ?
} else {
m_iTriggerCount + + ;
@ -421,7 +421,7 @@ void KviThreadManager::threadLeftWaitState()
m_iWaitingThreads - - ;
if ( m_iWaitingThreads < 0 )
{
d ebug( " Ops.. got a negative number of waiting threads ? " ) ;
tqD ebug( " Ops.. got a negative number of waiting threads ? " ) ;
m_iWaitingThreads = 0 ;
}
m_pMutex - > unlock ( ) ;
@ -462,11 +462,11 @@ KviThread::KviThread()
KviThread : : ~ KviThread ( )
{
// d ebug(">> KviThread::~KviThread() : (this = %d)",this);
// tqD ebug(">> KviThread::~KviThread() : (this = %d)",this);
wait ( ) ;
delete m_pRunningMutex ;
g_pThreadManager - > unregisterSlaveThread ( this ) ;
// d ebug("<< KviThread::~KviThread() : (this = %d)",this);
// tqD ebug("<< KviThread::~KviThread() : (this = %d)",this);
}
void KviThread : : setRunning ( bool bRunning )
@ -512,16 +512,16 @@ bool KviThread::start()
void KviThread : : wait ( )
{
// We're on the master side here...and we're waiting the slave to exit
// d ebug(">> KviThread::wait() (this=%d)",this);
// tqD ebug(">> KviThread::wait() (this=%d)",this);
while ( isStartingUp ( ) ) usleep ( 500 ) ; // sleep 500 microseconds
// d ebug("!! KviThread::wait() (this=%d)",this);
// tqD ebug("!! KviThread::wait() (this=%d)",this);
g_pThreadManager - > threadEnteredWaitState ( ) ;
while ( isRunning ( ) )
{
usleep ( 500 ) ; // sleep 500 microseconds
}
g_pThreadManager - > threadLeftWaitState ( ) ;
// d ebug("<< KviThread::wait() (this=%d)",this);
// tqD ebug("<< KviThread::wait() (this=%d)",this);
}
void KviThread : : exit ( )
@ -534,13 +534,13 @@ void KviThread::exit()
void KviThread : : internalThreadRun_doNotTouchThis ( )
{
// we're on the slave thread here!
// d ebug(">> KviThread::internalRun (this=%d)",this);
// tqD ebug(">> KviThread::internalRun (this=%d)",this);
setRunning ( true ) ;
setStartingUp ( false ) ;
kvi_threadInitialize ( ) ;
run ( ) ;
setRunning ( false ) ;
// d ebug("<< KviThread::internalRun (this=%d",this);
// tqD ebug("<< KviThread::internalRun (this=%d",this);
}
void KviThread : : usleep ( unsigned long usec )
@ -592,9 +592,9 @@ KviSensitiveThread::KviSensitiveThread()
KviSensitiveThread : : ~ KviSensitiveThread ( )
{
// d ebug("Entering KviSensitiveThread::~KviSensitiveThread (this=%d)",this);
// tqD ebug("Entering KviSensitiveThread::~KviSensitiveThread (this=%d)",this);
terminate ( ) ;
// d ebug("KviSensitiveThread::~KviSensitiveThread : terminate called (This=%d)",this);
// tqD ebug("KviSensitiveThread::~KviSensitiveThread : terminate called (This=%d)",this);
m_pLocalEventQueueMutex - > lock ( ) ;
m_pLocalEventQueue - > setAutoDelete ( true ) ;
delete m_pLocalEventQueue ;
@ -602,12 +602,12 @@ KviSensitiveThread::~KviSensitiveThread()
m_pLocalEventQueueMutex - > unlock ( ) ;
delete m_pLocalEventQueueMutex ;
m_pLocalEventQueueMutex = 0 ;
// d ebug("Exiting KviSensitiveThread::~KviSensitiveThread (this=%d)",this);
// tqD ebug("Exiting KviSensitiveThread::~KviSensitiveThread (this=%d)",this);
}
void KviSensitiveThread : : enqueueEvent ( KviThreadEvent * e )
{
// d ebug(">>> KviSensitiveThread::enqueueEvent() (this=%d)",this);
// tqD ebug(">>> KviSensitiveThread::enqueueEvent() (this=%d)",this);
m_pLocalEventQueueMutex - > lock ( ) ;
if ( ! m_pLocalEventQueue )
{
@ -618,27 +618,27 @@ void KviSensitiveThread::enqueueEvent(KviThreadEvent *e)
}
m_pLocalEventQueue - > append ( e ) ;
m_pLocalEventQueueMutex - > unlock ( ) ;
// d ebug("<<< KviSensitiveThread::enqueueEvent() (this=%d)",this);
// tqD ebug("<<< KviSensitiveThread::enqueueEvent() (this=%d)",this);
}
KviThreadEvent * KviSensitiveThread : : dequeueEvent ( )
{
// d ebug(">>> KviSensitiveThread::dequeueEvent() (this=%d)",this);
// tqD ebug(">>> KviSensitiveThread::dequeueEvent() (this=%d)",this);
KviThreadEvent * ret ;
m_pLocalEventQueueMutex - > lock ( ) ;
ret = m_pLocalEventQueue - > first ( ) ;
if ( ret ) m_pLocalEventQueue - > removeFirst ( ) ;
m_pLocalEventQueueMutex - > unlock ( ) ;
// d ebug("<<< KviSensitiveThread::dequeueEvent() (this=%d)",this);
// tqD ebug("<<< KviSensitiveThread::dequeueEvent() (this=%d)",this);
return ret ;
}
void KviSensitiveThread : : terminate ( )
{
// d ebug("Entering KviSensitiveThread::terminate (this=%d)",this);
// tqD ebug("Entering KviSensitiveThread::terminate (this=%d)",this);
enqueueEvent ( new KviThreadEvent ( KVI_THREAD_EVENT_TERMINATE ) ) ;
// d ebug("KviSensitiveThread::terminate() : event enqueued waiting (this=%d)",this);
// tqD ebug("KviSensitiveThread::terminate() : event enqueued waiting (this=%d)",this);
wait ( ) ;
// d ebug("Exiting KviSensitiveThread::terminate (this=%d)",this);
// tqD ebug("Exiting KviSensitiveThread::terminate (this=%d)",this);
}