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