THRIFT-3932 fixed ThreadManager concurrency issues, added more tests in that area, did a little refactoring and prettying up along the way
Client: C++
This closes #1103
diff --git a/lib/cpp/test/concurrency/TimerManagerTests.h b/lib/cpp/test/concurrency/TimerManagerTests.h
index c6fa4cf..32d3935 100644
--- a/lib/cpp/test/concurrency/TimerManagerTests.h
+++ b/lib/cpp/test/concurrency/TimerManagerTests.h
@@ -34,8 +34,6 @@
class TimerManagerTests {
- static const double TEST_TOLERANCE;
-
public:
class Task : public Runnable {
public:
@@ -52,25 +50,11 @@
void run() {
_endTime = Util::currentTime();
-
- // Figure out error percentage
-
- int64_t delta = _endTime - _startTime;
-
- delta = delta > _timeout ? delta - _timeout : _timeout - delta;
-
- double error = double(delta) / _timeout;
-
- if (error < TEST_TOLERANCE) {
- _success = true;
- }
-
- _done = true;
-
- std::cout << "\t\t\tTimerManagerTests::Task[" << this << "] done" << std::endl; // debug
+ _success = (_endTime - _startTime) >= _timeout;
{
Synchronized s(_monitor);
+ _done = true;
_monitor.notifyAll();
}
}
@@ -147,7 +131,6 @@
Monitor _monitor;
};
-const double TimerManagerTests::TEST_TOLERANCE = .20;
}
}
}