From a11b6076410330386739f00030046e74063421e9 Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Mon, 5 Nov 2007 22:39:27 +0000 Subject: 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 --- cpp/src/qpid/broker/Timer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cpp/src/qpid/broker/Timer.cpp') 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); -- cgit v1.2.1