summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/Timer.cpp
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2007-11-05 22:39:27 +0000
committerKim van der Riet <kpvdr@apache.org>2007-11-05 22:39:27 +0000
commita11b6076410330386739f00030046e74063421e9 (patch)
tree1302556017fcccd4fa82b0efc8109125b23aa7c0 /cpp/src/qpid/broker/Timer.cpp
parentb07b0a633be48c74122f5a0cb04eafc57fb6a96b (diff)
downloadqpid-python-a11b6076410330386739f00030046e74063421e9.tar.gz
Added reset function to class AbsTime, thus allowing same instance of TimerTask to be reset and used again for the same duration as initially set
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@592170 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/Timer.cpp')
-rw-r--r--cpp/src/qpid/broker/Timer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/Timer.cpp b/cpp/src/qpid/broker/Timer.cpp
index f721ba5ef5..653e1dffd1 100644
--- a/cpp/src/qpid/broker/Timer.cpp
+++ b/cpp/src/qpid/broker/Timer.cpp
@@ -27,9 +27,10 @@ using qpid::sys::Monitor;
using qpid::sys::Thread;
using namespace qpid::broker;
-TimerTask::TimerTask(Duration timeout) : time(AbsTime::now(), timeout), cancelled(false) {}
-TimerTask::TimerTask(AbsTime _time) : time(_time), cancelled(false) {}
+TimerTask::TimerTask(Duration timeout) : duration(timeout), time(AbsTime::now(), timeout), cancelled(false) {}
+TimerTask::TimerTask(AbsTime _time) : duration(0), time(_time), cancelled(false) {}
TimerTask::~TimerTask(){}
+void TimerTask::reset() { time.reset(AbsTime::now(), duration); }
Timer::Timer() : active(false)
{
@@ -82,6 +83,7 @@ void Timer::stop()
signalStop();
runner.join();
}
+
void Timer::signalStop()
{
Monitor::ScopedLock l(monitor);
@@ -110,6 +112,7 @@ TimerA::~TimerA()
{
stop();
}
+
void TimerA::run()
{
Monitor::ScopedLock l(monitor);
@@ -157,6 +160,7 @@ void TimerA::stop()
signalStop();
runner.join();
}
+
void TimerA::signalStop()
{
Monitor::ScopedLock l(monitor);