diff --git a/src/libCom/timer/timer.cpp b/src/libCom/timer/timer.cpp index ae8f684f3..f19bbc4cd 100644 --- a/src/libCom/timer/timer.cpp +++ b/src/libCom/timer/timer.cpp @@ -66,7 +66,7 @@ void timer::start ( epicsTimerNotify & notify, const epicsTime & expire ) void timer::privateStart ( epicsTimerNotify & notify, const epicsTime & expire ) { this->pNotify = & notify; - this->exp = expire - this->queue.sleepQuantumOverTwo; + this->exp = expire - ( this->queue.notify.quantum () / 2.0 ); bool reschedualNeeded = false; if ( this->curState == stateActive ) { diff --git a/src/libCom/timer/timerPrivate.h b/src/libCom/timer/timerPrivate.h index b530ed604..8ef6a23e5 100644 --- a/src/libCom/timer/timerPrivate.h +++ b/src/libCom/timer/timerPrivate.h @@ -100,7 +100,6 @@ private: mutable epicsMutex mutex; epicsEvent cancelBlockingEvent; tsDLList < timer > timerList; - const double sleepQuantumOverTwo; epicsTimerQueueNotify & notify; timer * pExpireTmr; epicsThreadId processThread; @@ -138,6 +137,7 @@ private: epicsEvent rescheduleEvent; epicsEvent exitEvent; epicsThread thread; + double sleepQuantum; bool okToShare; bool exitFlag; bool terminateFlag; diff --git a/src/libCom/timer/timerQueue.cpp b/src/libCom/timer/timerQueue.cpp index 7f9cd5cf1..c4f69eb0a 100644 --- a/src/libCom/timer/timerQueue.cpp +++ b/src/libCom/timer/timerQueue.cpp @@ -21,8 +21,7 @@ epicsTimerQueue::~epicsTimerQueue () {} -timerQueue::timerQueue ( epicsTimerQueueNotify ¬ifyIn ) : - sleepQuantumOverTwo ( notifyIn.quantum () / 2.0 ), +timerQueue::timerQueue ( epicsTimerQueueNotify & notifyIn ) : notify ( notifyIn ), pExpireTmr ( 0 ), processThread ( 0 ), cancelPending ( false ) { diff --git a/src/libCom/timer/timerQueueActive.cpp b/src/libCom/timer/timerQueueActive.cpp index e7ee0a3c4..61c191e01 100644 --- a/src/libCom/timer/timerQueueActive.cpp +++ b/src/libCom/timer/timerQueueActive.cpp @@ -43,7 +43,8 @@ epicsTimerQueueActive & epicsTimerQueueActive::allocate ( bool okToShare, unsign timerQueueActive::timerQueueActive ( bool okToShareIn, unsigned priority ) : queue ( *this ), thread ( *this, "timerQueue", epicsThreadGetStackSize ( epicsThreadStackMedium ), priority ), - okToShare ( okToShareIn ), exitFlag ( false ), terminateFlag ( false ) + sleepQuantum ( epicsThreadSleepQuantum() ), okToShare ( okToShareIn ), + exitFlag ( false ), terminateFlag ( false ) { this->thread.start (); } @@ -88,7 +89,7 @@ void timerQueueActive::reschedule () double timerQueueActive::quantum () { - return epicsThreadSleepQuantum (); + return this->sleepQuantum; } void timerQueueActive::show ( unsigned int level ) const