From 5f1c656aedd9e7d9a13e4457c046557b81b34c9b Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 26 Mar 2003 22:16:04 +0000 Subject: [PATCH] move sleep quantum cache to proper place in the fdManager class --- src/libCom/fdmgr/fdManager.cpp | 23 +++++++++++------------ src/libCom/fdmgr/fdManager.h | 2 +- src/libCom/timer/timerPrivate.h | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/libCom/fdmgr/fdManager.cpp b/src/libCom/fdmgr/fdManager.cpp index f53c054b3..0cbd5369a 100644 --- a/src/libCom/fdmgr/fdManager.cpp +++ b/src/libCom/fdmgr/fdManager.cpp @@ -44,20 +44,21 @@ const unsigned uSecPerSec = 1000u * mSecPerSec; // // fdManager::fdManager() // -epicsShareFunc fdManager::fdManager () : pTimerQueue ( 0 ) +// hopefully its a reasonable guess that select() and epicsThreadSleep() +// will have the same sleep quantum +// +epicsShareFunc fdManager::fdManager () : + sleepQuantum ( epicsThreadSleepQuantum () ), pTimerQueue ( 0 ), + maxFD ( 0 ), processInProg ( false ), pCBReg ( 0 ) { - size_t i; - int status; - - status = osiSockAttach (); + int status = osiSockAttach (); assert (status); - for ( i=0u; i < sizeof (this->fdSets) / sizeof ( this->fdSets[0u] ); i++ ) { + for ( size_t i = 0u; + i < sizeof (this->fdSets) / sizeof ( this->fdSets[0u] ); + i++ ) { FD_ZERO ( &this->fdSets[i] ); // X aCC 392 } - this->maxFD = 0; - this->processInProg = false; - this->pCBReg = 0; } // @@ -317,9 +318,7 @@ void fdManager::reschedule () double fdManager::quantum () { - // hopefully its a reasonable guess that select() and epicsThreadSleep() - // will have the same sleep quantum - return epicsThreadSleepQuantum (); + return this->sleepQuantum; } // diff --git a/src/libCom/fdmgr/fdManager.h b/src/libCom/fdmgr/fdManager.h index 36d029a7b..b09ed10f4 100644 --- a/src/libCom/fdmgr/fdManager.h +++ b/src/libCom/fdmgr/fdManager.h @@ -91,7 +91,7 @@ private: tsDLList < fdReg > activeList; resTable < fdReg, fdRegId > fdTbl; fd_set fdSets[fdrNEnums]; - double sleepQuantum; + const double sleepQuantum; epicsTimerQueuePassive * pTimerQueue; SOCKET maxFD; bool processInProg; diff --git a/src/libCom/timer/timerPrivate.h b/src/libCom/timer/timerPrivate.h index 8ef6a23e5..0d0a4794f 100644 --- a/src/libCom/timer/timerPrivate.h +++ b/src/libCom/timer/timerPrivate.h @@ -137,7 +137,7 @@ private: epicsEvent rescheduleEvent; epicsEvent exitEvent; epicsThread thread; - double sleepQuantum; + const double sleepQuantum; bool okToShare; bool exitFlag; bool terminateFlag;