Rename to DeadlineTimer::cancel()

This commit is contained in:
Vinnie Falco
2013-09-14 19:59:34 -07:00
parent 77874ee518
commit 83b9d22ff0
3 changed files with 15 additions and 26 deletions

View File

@@ -97,7 +97,7 @@ PagedFreeStore::PagedFreeStore (const size_t pageBytes)
PagedFreeStore::~PagedFreeStore () PagedFreeStore::~PagedFreeStore ()
{ {
m_timer.reset (); m_timer.cancel ();
#if LOG_GC #if LOG_GC
bassert (!m_used.isSignaled ()); bassert (!m_used.isSignaled ());

View File

@@ -214,6 +214,11 @@ DeadlineTimer::~DeadlineTimer ()
m_manager->deactivate (*this); m_manager->deactivate (*this);
} }
void DeadlineTimer::cancel ()
{
m_manager->deactivate (*this);
}
void DeadlineTimer::setExpiration (double secondsUntilDeadline) void DeadlineTimer::setExpiration (double secondsUntilDeadline)
{ {
bassert (secondsUntilDeadline != 0); bassert (secondsUntilDeadline != 0);
@@ -237,7 +242,3 @@ void DeadlineTimer::setExpirationTime (Time const& when)
m_manager->activate (*this, 0, when); m_manager->activate (*this, 0, when);
} }
void DeadlineTimer::reset ()
{
m_manager->deactivate (*this);
}

View File

@@ -45,13 +45,18 @@ public:
~DeadlineTimer (); ~DeadlineTimer ();
/** Cancel all notifications.
It is okay to call this on an inactive timer.
@note It is guaranteed that no notifications will occur after this
function returns.
*/
void cancel ();
/** Set the timer to go off once in the future. /** Set the timer to go off once in the future.
If the timer is already active, this will reset it. If the timer is already active, this will reset it.
@note If the timer is already active, the old one might go off @note If the timer is already active, the old one might go off
before this function returns. before this function returns.
@param secondsUntilDeadline The number of seconds until the timer @param secondsUntilDeadline The number of seconds until the timer
will send a notification. This must be will send a notification. This must be
greater than zero. greater than zero.
@@ -59,12 +64,9 @@ public:
void setExpiration (double secondsUntilDeadline); void setExpiration (double secondsUntilDeadline);
/** Set the timer to go off repeatedly with the specified frequency. /** Set the timer to go off repeatedly with the specified frequency.
If the timer is already active, this will reset it. If the timer is already active, this will reset it.
@note If the timer is already active, the old one might go off @note If the timer is already active, the old one might go off
before this function returns. before this function returns.
@param secondsUntilDeadline The number of seconds until the timer @param secondsUntilDeadline The number of seconds until the timer
will send a notification. This must be will send a notification. This must be
greater than zero. greater than zero.
@@ -72,28 +74,15 @@ public:
void setRecurringExpiration (double secondsUntilDeadline); void setRecurringExpiration (double secondsUntilDeadline);
/** Set the timer to go off at a specific time. /** Set the timer to go off at a specific time.
If the timer is already active, this will reset it. If the timer is already active, this will reset it.
@note If the timer is already active, the old one might go off @note If the timer is already active, the old one might go off
before this function returns. before this function returns.
@note If the time is in the past, the timer will go off @note If the time is in the past, the timer will go off
immediately. immediately.
*/ */
void setExpirationTime (Time const& when); void setExpirationTime (Time const& when);
/** Reset the timer so that no more notifications are sent.
It is okay to call this on an inactive timer.
@note It is guaranteed that no notifications will occur after this
function returns.
*/
void reset ();
/** Equality comparison. /** Equality comparison.
Timers are equal if they have the same address. Timers are equal if they have the same address.
*/ */
inline bool operator== (DeadlineTimer const& other) const inline bool operator== (DeadlineTimer const& other) const
@@ -101,8 +90,7 @@ public:
return this == &other; return this == &other;
} }
/** Inequality comparison. /** Inequality comparison. */
*/
inline bool operator!= (DeadlineTimer const& other) const inline bool operator!= (DeadlineTimer const& other) const
{ {
return this != &other; return this != &other;