some debugging code.
This commit is contained in:
parent
b3291bc2b5
commit
9435639545
|
@ -3,6 +3,7 @@
|
||||||
#include "XThread.h"
|
#include "XThread.h"
|
||||||
#include "CLock.h"
|
#include "CLock.h"
|
||||||
#include "CStopwatch.h"
|
#include "CStopwatch.h"
|
||||||
|
#include "CLog.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// CThreadPtr
|
// CThreadPtr
|
||||||
|
@ -75,6 +76,8 @@ void CThread::sleep(double timeout)
|
||||||
|
|
||||||
void CThread::exit(void* result)
|
void CThread::exit(void* result)
|
||||||
{
|
{
|
||||||
|
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
||||||
|
log((CLOG_DEBUG "throw exit on thread %p", currentRep.operator->()));
|
||||||
throw XThreadExit(result);
|
throw XThreadExit(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "CMutex.h"
|
#include "CMutex.h"
|
||||||
#include "CLock.h"
|
#include "CLock.h"
|
||||||
#include "XThread.h"
|
#include "XThread.h"
|
||||||
|
#include "CLog.h"
|
||||||
#include "IJob.h"
|
#include "IJob.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -229,14 +230,19 @@ void CThreadRep::doThreadFunc()
|
||||||
|
|
||||||
catch (XThreadCancel&) {
|
catch (XThreadCancel&) {
|
||||||
// client called cancel()
|
// client called cancel()
|
||||||
|
log((CLOG_DEBUG "caught cancel on thread %p", this));
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (XThreadExit& e) {
|
catch (XThreadExit& e) {
|
||||||
// client called exit()
|
// client called exit()
|
||||||
result = e.m_result;
|
result = e.m_result;
|
||||||
|
log((CLOG_DEBUG "caught exit on thread %p", this));
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
log((CLOG_DEBUG "caught exit on thread %p", this));
|
||||||
|
// note -- don't catch (...) to avoid masking bugs
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
// note -- don't catch (...) to avoid masking bugs
|
|
||||||
|
|
||||||
// done with job
|
// done with job
|
||||||
delete m_job;
|
delete m_job;
|
||||||
|
@ -286,6 +292,7 @@ void CThreadRep::cancel()
|
||||||
m_cancel = true;
|
m_cancel = true;
|
||||||
|
|
||||||
// break out of system calls
|
// break out of system calls
|
||||||
|
log((CLOG_DEBUG "cancel thread %p", this));
|
||||||
pthread_kill(m_thread, SIGALRM);
|
pthread_kill(m_thread, SIGALRM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,6 +311,7 @@ void CThreadRep::testCancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
// start cancel
|
// start cancel
|
||||||
|
log((CLOG_DEBUG "throw cancel on thread %p", this));
|
||||||
throw XThreadCancel();
|
throw XThreadCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,6 +409,7 @@ void CThreadRep::sleep(double timeout)
|
||||||
|
|
||||||
void CThreadRep::cancel()
|
void CThreadRep::cancel()
|
||||||
{
|
{
|
||||||
|
log((CLOG_DEBUG "cancel thread %p", this));
|
||||||
SetEvent(m_cancel);
|
SetEvent(m_cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,6 +432,7 @@ void CThreadRep::testCancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
// start cancel
|
// start cancel
|
||||||
|
log((CLOG_DEBUG "throw cancel on thread %p", this));
|
||||||
throw XThreadCancel();
|
throw XThreadCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,10 @@ CTimerThread::CTimerThread(double timeout) : m_timeout(timeout)
|
||||||
|
|
||||||
CTimerThread::~CTimerThread()
|
CTimerThread::~CTimerThread()
|
||||||
{
|
{
|
||||||
|
log((CLOG_DEBUG "cancelling timeout"));
|
||||||
m_timingThread->cancel();
|
m_timingThread->cancel();
|
||||||
|
m_timingThread->wait();
|
||||||
|
log((CLOG_DEBUG "cancelled timeout"));
|
||||||
delete m_timingThread;
|
delete m_timingThread;
|
||||||
delete m_callingThread;
|
delete m_callingThread;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue