From 8fa9db48ad6295b1ed89d023a5e46553b3229db5 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 16 Jun 2000 23:36:37 +0000 Subject: [PATCH] added new activate methods --- src/libCom/timer/osiTimer.cpp | 37 +++++++++++++++++++++++++++++++++++ src/libCom/timer/osiTimer.h | 10 ++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/libCom/timer/osiTimer.cpp b/src/libCom/timer/osiTimer.cpp index 62e78e471..a6a52dcc4 100644 --- a/src/libCom/timer/osiTimer.cpp +++ b/src/libCom/timer/osiTimer.cpp @@ -196,6 +196,43 @@ void osiTimer::reschedule (double newDelay) this->queue.timerLists[this->curState].remove (*this); this->curState = stateLimbo; this->arm (newDelay); + + this->queue.mutex.unlock (); +} + +// +// Start the timer with delay this->delay() if inactive +// +epicsShareFunc void osiTimer::activate () +{ + this->activate ( this->delay () ); +} + +// +// Start the timer with delay newDelay if inactive +// +epicsShareFunc void osiTimer::activate ( double newDelay ) +{ + if ( this->curState == stateLimbo ) { + return; // queue was destroyed + } + + this->queue.mutex.lock (); + + if ( this->curState == stateIdle ) { + // + // signal the timer queue if this + // occurring during the expire call + // back + // + if ( this == this->queue.pExpireTmr ) { + this->queue.pExpireTmr = 0; + } + this->queue.timerLists[this->curState].remove (*this); + this->curState = stateLimbo; + this->arm (newDelay); + } + this->queue.mutex.unlock (); } diff --git a/src/libCom/timer/osiTimer.h b/src/libCom/timer/osiTimer.h index ab283dfab..bf91468cc 100644 --- a/src/libCom/timer/osiTimer.h +++ b/src/libCom/timer/osiTimer.h @@ -75,6 +75,16 @@ public: */ epicsShareFunc void reschedule (); + /* + * Start the timer with delay newDelay if inactive. + */ + epicsShareFunc void activate ( double newDelay ); + + /* + * Start the timer with delay this->delay() if inactive. + */ + epicsShareFunc void activate (); + /* * inactivate the timer and call the virtual destroy() * member function