From 0817ad51ba2a11c38e079108cb731567fdfe643c Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 23 Oct 2002 22:57:06 +0000 Subject: [PATCH] removed double checked lock optimzation --- src/ca/searchTimer.cpp | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/ca/searchTimer.cpp b/src/ca/searchTimer.cpp index a39bfa4dc..b260399d0 100644 --- a/src/ca/searchTimer.cpp +++ b/src/ca/searchTimer.cpp @@ -102,34 +102,29 @@ void searchTimer::recomputeTimerPeriodAndStartTimer ( unsigned minRetryNew, cons bool start = false; double totalDelay = initialDelay; - if ( this->iiu.channelCount() > 0 && this->minRetry > minRetryNew ) { - epicsGuard < searchTimerMutex > locker ( this->mutex ); + epicsGuard < searchTimerMutex > locker ( this->mutex ); - // double check mutex lock optimization is important because - // this gets called often when a channel is created and when a - // beacon anomaly occurs - if ( this->iiu.channelCount() == 0 || this->minRetry <= minRetryNew ) { - return; - } + if ( this->iiu.channelCount() == 0 || this->minRetry <= minRetryNew ) { + return; + } - double oldPeriod = this->period; + double oldPeriod = this->period; - this->recomputeTimerPeriod ( minRetryNew ); + this->recomputeTimerPeriod ( minRetryNew ); - totalDelay += this->period; + totalDelay += this->period; - if ( totalDelay < oldPeriod ) { - epicsTimer::expireInfo info = this->timer.getExpireInfo (); - if ( info.active ) { - double delay = epicsTime::getCurrent() - info.expireTime; - if ( delay > totalDelay ) { - start = true; - } - } - else { + if ( totalDelay < oldPeriod ) { + epicsTimer::expireInfo info = this->timer.getExpireInfo (); + if ( info.active ) { + double delay = epicsTime::getCurrent() - info.expireTime; + if ( delay > totalDelay ) { start = true; } } + else { + start = true; + } } if ( start ) {