summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/DtxManager.cpp2
-rw-r--r--cpp/src/qpid/broker/DtxWorkRecord.cpp2
-rw-r--r--cpp/src/qpid/broker/Timer.cpp5
-rw-r--r--cpp/src/qpid/broker/Timer.h6
4 files changed, 12 insertions, 3 deletions
diff --git a/cpp/src/qpid/broker/DtxManager.cpp b/cpp/src/qpid/broker/DtxManager.cpp
index f4494fccc6..11e16ec837 100644
--- a/cpp/src/qpid/broker/DtxManager.cpp
+++ b/cpp/src/qpid/broker/DtxManager.cpp
@@ -126,7 +126,7 @@ void DtxManager::setTimeout(const std::string& xid, uint32_t secs)
intrusive_ptr<DtxTimeout> timeout = record->getTimeout();
if (timeout.get()) {
if (timeout->timeout == secs) return;//no need to do anything further if timeout hasn't changed
- timeout->cancelled = true;
+ timeout->cancel();
}
timeout = intrusive_ptr<DtxTimeout>(new DtxTimeout(secs, *this, xid));
record->setTimeout(timeout);
diff --git a/cpp/src/qpid/broker/DtxWorkRecord.cpp b/cpp/src/qpid/broker/DtxWorkRecord.cpp
index cc79813dab..82e63211fa 100644
--- a/cpp/src/qpid/broker/DtxWorkRecord.cpp
+++ b/cpp/src/qpid/broker/DtxWorkRecord.cpp
@@ -34,7 +34,7 @@ DtxWorkRecord::DtxWorkRecord(const std::string& _xid, TransactionalStore* const
DtxWorkRecord::~DtxWorkRecord()
{
if (timeout.get()) {
- timeout->cancelled = true;
+ timeout->cancel();
}
}
diff --git a/cpp/src/qpid/broker/Timer.cpp b/cpp/src/qpid/broker/Timer.cpp
index 0b0d3ba63d..46bbdbb574 100644
--- a/cpp/src/qpid/broker/Timer.cpp
+++ b/cpp/src/qpid/broker/Timer.cpp
@@ -38,6 +38,9 @@ TimerTask::~TimerTask(){}
void TimerTask::reset() { time = AbsTime(AbsTime::now(), duration); }
+void TimerTask::cancel() { cancelled = true; }
+bool TimerTask::isCancelled() const { return cancelled; }
+
Timer::Timer() : active(false)
{
start();
@@ -56,7 +59,7 @@ void Timer::run()
monitor.wait();
} else {
intrusive_ptr<TimerTask> t = tasks.top();
- if (t->cancelled) {
+ if (t->isCancelled()) {
tasks.pop();
} else if(t->time < AbsTime::now()) {
tasks.pop();
diff --git a/cpp/src/qpid/broker/Timer.h b/cpp/src/qpid/broker/Timer.h
index f702f0f32d..be4ac9d056 100644
--- a/cpp/src/qpid/broker/Timer.h
+++ b/cpp/src/qpid/broker/Timer.h
@@ -34,7 +34,11 @@
namespace qpid {
namespace broker {
+class Timer;
+
struct TimerTask : public RefCounted {
+ friend class Timer;
+
const qpid::sys::Duration duration;
qpid::sys::AbsTime time;
volatile bool cancelled;
@@ -43,6 +47,8 @@ struct TimerTask : public RefCounted {
TimerTask(qpid::sys::AbsTime time);
virtual ~TimerTask();
void reset();
+ void cancel();
+ bool isCancelled() const;
virtual void fire() = 0;
};