mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-26 22:03:24 +08:00
Changed log() and logc() macros to LOG() and LOGC(), respectively.
This avoids a conflict with the standard math library log() function.
This commit is contained in:
@@ -61,7 +61,7 @@ CMutex::fini()
|
||||
{
|
||||
pthread_mutex_t* mutex = reinterpret_cast<pthread_mutex_t*>(m_mutex);
|
||||
int status = pthread_mutex_destroy(mutex);
|
||||
logc(status != 0, (CLOG_ERR "pthread_mutex_destroy status %d", status));
|
||||
LOGC(status != 0, (CLOG_ERR "pthread_mutex_destroy status %d", status));
|
||||
assert(status == 0);
|
||||
delete mutex;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ CMutex::lock() const
|
||||
break;
|
||||
|
||||
default:
|
||||
log((CLOG_ERR "pthread_mutex_lock status %d", status));
|
||||
LOG((CLOG_ERR "pthread_mutex_lock status %d", status));
|
||||
assert(0 && "unexpected error");
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ CMutex::unlock() const
|
||||
break;
|
||||
|
||||
default:
|
||||
log((CLOG_ERR "pthread_mutex_unlock status %d", status));
|
||||
LOG((CLOG_ERR "pthread_mutex_unlock status %d", status));
|
||||
assert(0 && "unexpected error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void
|
||||
CThread::exit(void* result)
|
||||
{
|
||||
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
||||
log((CLOG_DEBUG1 "throw exit on thread %p", currentRep.operator->()));
|
||||
LOG((CLOG_DEBUG1 "throw exit on thread %p", currentRep.operator->()));
|
||||
throw XThreadExit(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -296,23 +296,23 @@ CThreadRep::doThreadFunc()
|
||||
void* result = NULL;
|
||||
try {
|
||||
// go
|
||||
log((CLOG_DEBUG1 "thread %p entry", this));
|
||||
LOG((CLOG_DEBUG1 "thread %p entry", this));
|
||||
m_job->run();
|
||||
log((CLOG_DEBUG1 "thread %p exit", this));
|
||||
LOG((CLOG_DEBUG1 "thread %p exit", this));
|
||||
}
|
||||
|
||||
catch (XThreadCancel&) {
|
||||
// client called cancel()
|
||||
log((CLOG_DEBUG1 "caught cancel on thread %p", this));
|
||||
LOG((CLOG_DEBUG1 "caught cancel on thread %p", this));
|
||||
}
|
||||
|
||||
catch (XThreadExit& e) {
|
||||
// client called exit()
|
||||
result = e.m_result;
|
||||
log((CLOG_DEBUG1 "caught exit on thread %p", this));
|
||||
LOG((CLOG_DEBUG1 "caught exit on thread %p", this));
|
||||
}
|
||||
catch (...) {
|
||||
log((CLOG_DEBUG1 "exception on thread %p", this));
|
||||
LOG((CLOG_DEBUG1 "exception on thread %p", this));
|
||||
// note -- don't catch (...) to avoid masking bugs
|
||||
delete m_job;
|
||||
throw;
|
||||
@@ -385,7 +385,7 @@ CThreadRep::cancel()
|
||||
}
|
||||
|
||||
// break out of system calls
|
||||
log((CLOG_DEBUG1 "cancel thread %p", this));
|
||||
LOG((CLOG_DEBUG1 "cancel thread %p", this));
|
||||
pthread_kill(m_thread, SIGWAKEUP);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ CThreadRep::testCancel()
|
||||
}
|
||||
|
||||
// start cancel
|
||||
log((CLOG_DEBUG1 "throw cancel on thread %p", this));
|
||||
LOG((CLOG_DEBUG1 "throw cancel on thread %p", this));
|
||||
throw XThreadCancel();
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ CThreadRep::sleep(
|
||||
void
|
||||
CThreadRep::cancel()
|
||||
{
|
||||
log((CLOG_DEBUG1 "cancel thread %p", this));
|
||||
LOG((CLOG_DEBUG1 "cancel thread %p", this));
|
||||
SetEvent(m_cancel);
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ CThreadRep::testCancel()
|
||||
}
|
||||
|
||||
// start cancel
|
||||
log((CLOG_DEBUG1 "throw cancel on thread %p", this));
|
||||
LOG((CLOG_DEBUG1 "throw cancel on thread %p", this));
|
||||
throw XThreadCancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ CTimerThread::CTimerThread(double timeout) : m_timeout(timeout)
|
||||
CTimerThread::~CTimerThread()
|
||||
{
|
||||
if (m_timingThread != NULL) {
|
||||
log((CLOG_DEBUG1 "cancelling timeout"));
|
||||
LOG((CLOG_DEBUG1 "cancelling timeout"));
|
||||
m_timingThread->cancel();
|
||||
m_timingThread->wait();
|
||||
log((CLOG_DEBUG1 "cancelled timeout"));
|
||||
LOG((CLOG_DEBUG1 "cancelled timeout"));
|
||||
delete m_timingThread;
|
||||
delete m_callingThread;
|
||||
}
|
||||
@@ -49,8 +49,8 @@ CTimerThread::~CTimerThread()
|
||||
void
|
||||
CTimerThread::timer(void*)
|
||||
{
|
||||
log((CLOG_DEBUG1 "timeout in %f seconds", m_timeout));
|
||||
LOG((CLOG_DEBUG1 "timeout in %f seconds", m_timeout));
|
||||
CThread::sleep(m_timeout);
|
||||
log((CLOG_DEBUG1 "timeout"));
|
||||
LOG((CLOG_DEBUG1 "timeout"));
|
||||
m_callingThread->cancel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user