diff --git a/src/libCom/timer/timer.cpp b/src/libCom/timer/timer.cpp index ba17659e3..0c17fd72f 100644 --- a/src/libCom/timer/timer.cpp +++ b/src/libCom/timer/timer.cpp @@ -156,12 +156,10 @@ void timer::cancel () if ( this->queue.processThread != epicsThreadGetIdSelf() ) { // make certain timer expire() does not run after cancel () returns, // but dont require that lock is applied while calling expire() - { + while ( this->queue.cancelPending && + this->queue.pExpireTmr == this ) { epicsGuardRelease < epicsMutex > autoRelease ( locker ); - while ( this->queue.cancelPending && - this->queue.pExpireTmr == this ) { - this->queue.cancelBlockingEvent.wait (); - } + this->queue.cancelBlockingEvent.wait (); } // in case other threads are waiting wakeupCancelBlockingThreads = true;