summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2009-07-13 15:00:58 +0000
committerKim van der Riet <kpvdr@apache.org>2009-07-13 15:00:58 +0000
commit15daf8342812786490f8a8dabcc5ba3cee8593e6 (patch)
tree69ce95f978a7c6b7cfded0f025ffce7b1dd5d220 /cpp/src/qpid/sys
parentb7ec99208bb38dc0cad3a7fd42b8e652610a192a (diff)
downloadqpid-python-15daf8342812786490f8a8dabcc5ba3cee8593e6.tar.gz
Reverted checkins 793119, 793120, 793121, 793122 because of problems with heartbeats and the store tests.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@793602 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys')
-rw-r--r--cpp/src/qpid/sys/DispatchHandle.h6
-rw-r--r--cpp/src/qpid/sys/Timer.cpp12
-rw-r--r--cpp/src/qpid/sys/Timer.h3
3 files changed, 7 insertions, 14 deletions
diff --git a/cpp/src/qpid/sys/DispatchHandle.h b/cpp/src/qpid/sys/DispatchHandle.h
index 860665877c..916d4c641a 100644
--- a/cpp/src/qpid/sys/DispatchHandle.h
+++ b/cpp/src/qpid/sys/DispatchHandle.h
@@ -38,14 +38,14 @@ class DispatchHandleRef;
* you need to:
*
* - Subclass IOHandle, in the constructor supply an appropriate
- * IOHandlerPrivate object for the platform.
- *
+ * IOHandlerPrivate object for the platform.
+ *
* - Construct a DispatchHandle passing it your IOHandle and
* callback functions for read, write and disconnect events.
*
* - Ensure the DispatchHandle is not deleted until the poller is no longer using it.
* TODO: astitcher document DispatchHandleRef to simplify this.
- *
+ *
* When an event occurs on the handle, the poller calls the relevant callback and
* stops watching that handle. Your callback can call rewatch() or related functions
* to re-enable polling.
diff --git a/cpp/src/qpid/sys/Timer.cpp b/cpp/src/qpid/sys/Timer.cpp
index fd42d7d62e..6967d812ae 100644
--- a/cpp/src/qpid/sys/Timer.cpp
+++ b/cpp/src/qpid/sys/Timer.cpp
@@ -30,14 +30,12 @@ namespace qpid {
namespace sys {
TimerTask::TimerTask(Duration timeout) :
- sortTime(AbsTime::FarFuture()),
period(timeout),
nextFireTime(AbsTime::now(), timeout),
cancelled(false)
{}
TimerTask::TimerTask(AbsTime time) :
- sortTime(AbsTime::FarFuture()),
period(0),
nextFireTime(time),
cancelled(false)
@@ -62,7 +60,7 @@ void TimerTask::setupNextFire() {
}
// Only allow tasks to be delayed
-void TimerTask::restart() { nextFireTime = max(nextFireTime, AbsTime(AbsTime::now(), period)); }
+void TimerTask::restart() { nextFireTime = AbsTime(AbsTime::now(), period); }
void TimerTask::delayTill(AbsTime time) { period = 0; nextFireTime = max(nextFireTime, time); }
void TimerTask::cancel() {
@@ -93,7 +91,7 @@ void Timer::run()
tasks.pop();
{
ScopedLock<Mutex> l(t->callbackLock);
- if (t->cancelled) {
+ if (t->isCancelled()) {
continue;
} else if(t->readyToFire()) {
Monitor::ScopedUnlock u(monitor);
@@ -102,9 +100,6 @@ void Timer::run()
} else {
// If the timer was adjusted into the future it might no longer
// be the next event, so push and then get top to make sure
- // You can only push events into the future
- assert(!(t->nextFireTime < t->sortTime));
- t->sortTime = t->nextFireTime;
tasks.push(t);
}
}
@@ -116,7 +111,6 @@ void Timer::run()
void Timer::add(intrusive_ptr<TimerTask> task)
{
Monitor::ScopedLock l(monitor);
- task->sortTime = task->nextFireTime;
tasks.push(task);
monitor.notify();
}
@@ -145,7 +139,7 @@ bool operator<(const intrusive_ptr<TimerTask>& a,
const intrusive_ptr<TimerTask>& b)
{
// Lower priority if time is later
- return a.get() && b.get() && a->sortTime > b->sortTime;
+ return a.get() && b.get() && a->nextFireTime > b->nextFireTime;
}
}}
diff --git a/cpp/src/qpid/sys/Timer.h b/cpp/src/qpid/sys/Timer.h
index fc7491d5ed..b5bf5d8a4c 100644
--- a/cpp/src/qpid/sys/Timer.h
+++ b/cpp/src/qpid/sys/Timer.h
@@ -42,7 +42,6 @@ class TimerTask : public RefCounted {
friend bool operator<(const boost::intrusive_ptr<TimerTask>&,
const boost::intrusive_ptr<TimerTask>&);
- AbsTime sortTime;
Duration period;
AbsTime nextFireTime;
Mutex callbackLock;
@@ -72,7 +71,7 @@ bool operator<(const boost::intrusive_ptr<TimerTask>& a,
const boost::intrusive_ptr<TimerTask>& b);
class Timer : private Runnable {
- qpid::sys::Monitor monitor;
+ qpid::sys::Monitor monitor;
std::priority_queue<boost::intrusive_ptr<TimerTask> > tasks;
qpid::sys::Thread runner;
bool active;