From aa160c0a2b8ccc3f516dcf3e363a697b14bd5d05 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 13 May 2003 20:45:51 +0000 Subject: [PATCH] restructured locking to match current design practices for CAC --- src/ca/searchTimer.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ca/searchTimer.h b/src/ca/searchTimer.h index df78fff2d..cea0132f8 100644 --- a/src/ca/searchTimer.h +++ b/src/ca/searchTimer.h @@ -33,6 +33,7 @@ #endif #include "epicsMutex.h" +#include "epicsGuard.h" #include "epicsTimer.h" #ifdef searchTimerh_epicsExportSharedSymbols @@ -42,24 +43,25 @@ #include "caProto.h" -class searchTimerMutex : public epicsMutex {}; +class udpMutex; class searchTimer : private epicsTimerNotify { public: - searchTimer ( class udpiiu &, epicsTimerQueue & ); + searchTimer ( class udpiiu &, epicsTimerQueue &, udpMutex & ); virtual ~searchTimer (); - void notifySearchResponse ( ca_uint32_t respDatagramSeqNo, + void notifySearchResponse ( epicsGuard < udpMutex > &, + ca_uint32_t respDatagramSeqNo, bool seqNumberIsValid, const epicsTime & currentTime ); - void newChannleNotify ( + void newChannelNotify ( epicsGuard < udpMutex > &, const epicsTime & currentTime, bool firstChannel ); - void beaconAnomalyNotify ( + void beaconAnomalyNotify ( epicsGuard < udpMutex > &, const epicsTime & currentTime, const double & delay ); void show ( unsigned level ) const; private: - class searchTimerMutex mutex; double period; /* period between tries */ epicsTimer & timer; class udpiiu & iiu; + udpMutex & mutex; unsigned framesPerTry; /* # of UDP frames per search try */ unsigned framesPerTryCongestThresh; /* one half N tries w congest */ unsigned minRetry; /* min retry number so far */ @@ -71,8 +73,8 @@ private: ca_uint32_t dgSeqNoAtTimerExpireBegin; ca_uint32_t dgSeqNoAtTimerExpireEnd; expireStatus expire ( const epicsTime & currentTime ); - void recomputeTimerPeriod ( unsigned minRetryNew ); - void recomputeTimerPeriodAndStartTimer ( + void recomputeTimerPeriod ( epicsGuard < udpMutex > &, unsigned minRetryNew ); + void recomputeTimerPeriodAndStartTimer ( epicsGuard < udpMutex > &, const epicsTime & currentTime, unsigned minRetryNew, const double & initialDelay ); searchTimer ( const searchTimer & );