From 71827bb2ce7fb51ab1ae22837da6ad3b522a9770 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 9 May 2002 00:35:32 +0000 Subject: [PATCH] moved someof the functionality into the old interface --- src/ca/cac.h | 60 ++++++++++++++++++------------------- src/ca/cacChannel.cpp | 9 ------ src/ca/cacChannelNotify.cpp | 4 --- 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/src/ca/cac.h b/src/ca/cac.h index 066b14149..531eb7f0e 100644 --- a/src/ca/cac.h +++ b/src/ca/cac.h @@ -97,7 +97,7 @@ public: class cac : private cacRecycle, private cacDisconnectChannelPrivate { public: - cac ( cacNotify &, bool enablePreemptiveCallback = false ); + cac ( cacNotify &, bool enablePreemptiveCallbackIn ); virtual ~cac (); // beacon management @@ -105,17 +105,10 @@ public: unsigned beaconNumber, unsigned protocolRevision ); void repeaterSubscribeConfirmNotify (); - // outstanding IO count management routines - void incrementOutstandingIO (); - void decrementOutstandingIO (); - void decrementOutstandingIO ( unsigned sequenceNo ); - unsigned sequenceNumberOfOutstandingIO () const; - bool ioComplete () const; - // IO management void flushRequest (); - int pendIO ( const double &timeout ); - int pendEvent ( const double &timeout ); + void waitUntilNoRecvThreadsPending (); + epicsGuard < callbackMutex > callbackGuardFactory (); bool executeResponse ( epicsGuard < callbackMutex > &, tcpiiu &, caHdrLargeArray &, char *pMsgBody ); void ioCancel ( nciu &chan, const cacChannel::ioid &id ); @@ -153,9 +146,6 @@ public: void exception ( epicsGuard < callbackMutex > &, int status, const char * pContext, const char * pFileName, unsigned lineNo ); - // callback preemption control - int blockForEventAndEnableCallbacks ( epicsEvent &event, double timeout ); - // diagnostics unsigned connectionCount () const; void show ( unsigned level ) const; @@ -182,18 +172,29 @@ public: void selfTest () const; void notifyNewFD ( epicsGuard < callbackMutex > &, SOCKET ) const; void notifyDestroyFD ( epicsGuard < callbackMutex > &, SOCKET ) const; - void uninstallIIU ( tcpiiu &iiu ); bool preemptiveCallbakIsEnabled () const; double beaconPeriod ( const nciu & chan ) const; static unsigned lowestPriorityLevelAbove ( unsigned priority ); static unsigned highestPriorityLevelBelow ( unsigned priority ); - void tcpCircuitShutdown ( tcpiiu &, bool discardMessages ); + void initiateAbortShutdown ( tcpiiu & ); private: ipAddrToAsciiEngine ipToAEngine; cacServiceList services; chronIntIdResTable < nciu > chanTable; + // + // !!!! There is at this point no good reason + // !!!! to maintain one IO table for all types of + // !!!! IO. It would probably be better to maintain + // !!!! an independent table for each IO type. The + // !!!! new adaptive sized hash table will not + // !!!! waste memory. Making this change will + // !!!! avoid virtual function overhead when + // !!!! accessing the different types of IO. This + // !!!! approach would also probably be safer in + // !!!! terms of detecting damaged protocol. + // chronIntIdResTable < baseNMIU > ioTable; chronIntIdResTable @@ -218,23 +219,19 @@ private: // the primary mutex if both locks are needed callbackMutex cbMutex; mutable cacMutex mutex; - epicsEvent ioDone; epicsEvent iiuUninstall; epicsTimerQueueActive & timerQueue; char * pUserName; class udpiiu * pudpiiu; void * tcpSmallRecvBufFreeList; void * tcpLargeRecvBufFreeList; - epicsGuard * pCallbackGuard; cacNotify & notify; epicsThreadId initializingThreadsId; unsigned initializingThreadsPriority; unsigned maxRecvBytesTCP; - unsigned pndRecvCnt; - unsigned readSeq; + bool preemptiveCallbackEnabled; void privateUninstallIIU ( epicsGuard < callbackMutex > &, tcpiiu &iiu ); - void flushRequestPrivate (); void run (); void connectAllIO ( epicsGuard < cacMutex > &, nciu &chan ); void disconnectAllIO ( epicsGuard < cacMutex > & locker, nciu & chan, bool enableCallbacks ); @@ -329,11 +326,6 @@ inline unsigned cac::getInitializingThreadsPriority () const return this->initializingThreadsPriority; } -inline unsigned cac::sequenceNumberOfOutstandingIO () const -{ - return this->readSeq; -} - inline cacMutex & cac::mutexRef () { return this->mutex; @@ -384,14 +376,20 @@ inline void cac::releaseLargeBufferTCP ( char *pBuf ) freeListFree ( this->tcpLargeRecvBufFreeList, pBuf ); } -inline bool cac::ioComplete () const -{ - return ( this->pndRecvCnt == 0u ); -} - inline bool cac::preemptiveCallbakIsEnabled () const { - return ! this->pCallbackGuard; + return this->preemptiveCallbackEnabled; +} + +inline void cac::waitUntilNoRecvThreadsPending () +{ + this->cbMutex.waitUntilNoRecvThreadsPending (); +} + +inline epicsGuard < callbackMutex > cac::callbackGuardFactory () +{ + // facilitate the return value optimization + return ( epicsGuard < callbackMutex > ( this->cbMutex ) ); } inline void cacMutex::lock () diff --git a/src/ca/cacChannel.cpp b/src/ca/cacChannel.cpp index 25f424312..a2e87943d 100644 --- a/src/ca/cacChannel.cpp +++ b/src/ca/cacChannel.cpp @@ -39,10 +39,6 @@ caAccessRights cacChannel::accessRights () const return ar; } -void cacChannel::notifyStateChangeFirstConnectInCountOfOutstandingIO () -{ -} - unsigned cacChannel::searchAttempts () const { return 0u; @@ -63,11 +59,6 @@ bool cacChannel::connected () const return true; } -bool cacChannel::previouslyConnected () const -{ - return true; -} - void cacChannel::hostName ( char *pBuf, unsigned bufLength ) const { if ( bufLength ) { diff --git a/src/ca/cacChannelNotify.cpp b/src/ca/cacChannelNotify.cpp index c455c0136..b8fb0513c 100644 --- a/src/ca/cacChannelNotify.cpp +++ b/src/ca/cacChannelNotify.cpp @@ -24,7 +24,3 @@ cacChannelNotify::~cacChannelNotify () { } -bool cacChannelNotify::includeFirstConnectInCountOfOutstandingIO () const -{ - return false; -}