Added thread factory test - problems in thread
Fixed stupid typo in TimerManager::start
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664723 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Monitor.cc b/lib/cpp/src/concurrency/Monitor.cc
index a2e4276..f6144ba 100644
--- a/lib/cpp/src/concurrency/Monitor.cc
+++ b/lib/cpp/src/concurrency/Monitor.cc
@@ -1,8 +1,12 @@
#include "Monitor.h"
+#include "Exception.h"
#include "Util.h"
#include <assert.h>
#include <errno.h>
+
+#include <iostream>
+
#include <pthread.h>
@@ -57,19 +61,19 @@
if(timeout == 0LL) {
- pthread_cond_wait(&_pthread_cond, &_pthread_mutex);
+ assert(pthread_cond_wait(&_pthread_cond, &_pthread_mutex) == 0);
} else {
struct timespec abstime;
- Util::toAbsoluteTimespec(abstime, timeout);
-
int result = pthread_cond_timedwait(&_pthread_cond, &_pthread_mutex, &abstime);
if(result == ETIMEDOUT) {
- // XXX If result is timeout need to throw timeout exception
+ // XXX Add assert once currentTime is fixed to have ms resolution or better
+
+ // assert(Util::currentTime() >= (now + timeout));
}
}
}
@@ -101,7 +105,7 @@
Monitor::Monitor() : _impl(new Monitor::Impl()) {}
- Monitor::~Monitor() { delete _impl;}
+Monitor::~Monitor() { delete _impl;}
void Monitor::lock() const {_impl->lock();}