diff --git a/src/ca/netReadNotifyIO_IL.h b/src/ca/netReadNotifyIO_IL.h index c4b284a4b..cf12eec1b 100644 --- a/src/ca/netReadNotifyIO_IL.h +++ b/src/ca/netReadNotifyIO_IL.h @@ -20,11 +20,13 @@ inline void * netReadNotifyIO::operator new ( size_t size ) { + epicsAutoMutex locker ( netReadNotifyIO::freeListMutex ); return netReadNotifyIO::freeList.allocate ( size ); } inline void netReadNotifyIO::operator delete ( void *pCadaver, size_t size ) { + epicsAutoMutex locker ( netReadNotifyIO::freeListMutex ); netReadNotifyIO::freeList.release ( pCadaver, size ); } diff --git a/src/ca/netSubscription_IL.h b/src/ca/netSubscription_IL.h index 930f6dd7d..4b9f76ff2 100644 --- a/src/ca/netSubscription_IL.h +++ b/src/ca/netSubscription_IL.h @@ -20,27 +20,21 @@ inline void * netSubscription::operator new ( size_t size ) { + epicsAutoMutex locker ( netSubscription::freeListMutex ); return netSubscription::freeList.allocate ( size ); } inline void netSubscription::operator delete ( void *pCadaver, size_t size ) { + epicsAutoMutex locker ( netSubscription::freeListMutex ); netSubscription::freeList.release ( pCadaver, size ); } inline unsigned long netSubscription::getCount () const { - if ( this->chan.connected () ) { - unsigned long nativeCount = chan.nativeElementCount (); - if ( this->count == 0u ) { - return nativeCount; - } - else if ( this->count > nativeCount ) { - return nativeCount; - } - else { - return this->count; - } + unsigned long nativeCount = chan.nativeElementCount (); + if ( this->count == 0u || this->count > nativeCount ) { + return nativeCount; } else { return this->count; diff --git a/src/ca/netWriteNotifyIO_IL.h b/src/ca/netWriteNotifyIO_IL.h index d2bdcc931..1bea6cfe4 100644 --- a/src/ca/netWriteNotifyIO_IL.h +++ b/src/ca/netWriteNotifyIO_IL.h @@ -15,16 +15,15 @@ * 505 665 1831 */ -// -// netWriteNotifyIO inline member functions -// inline void * netWriteNotifyIO::operator new ( size_t size ) { + epicsAutoMutex locker ( netWriteNotifyIO::freeListMutex ); return netWriteNotifyIO::freeList.allocate ( size ); } inline void netWriteNotifyIO::operator delete ( void *pCadaver, size_t size ) { + epicsAutoMutex locker ( netWriteNotifyIO::freeListMutex ); netWriteNotifyIO::freeList.release ( pCadaver, size ); } diff --git a/src/ca/oldChannelNotify.cpp b/src/ca/oldChannelNotify.cpp index 4bd5c39b6..70dce2b9f 100644 --- a/src/ca/oldChannelNotify.cpp +++ b/src/ca/oldChannelNotify.cpp @@ -19,6 +19,7 @@ #include "oldAccess.h" tsFreeList < class oldChannelNotify, 1024 > oldChannelNotify::freeList; +epicsMutex oldChannelNotify::freeListMutex; extern "C" void cacNoopConnHandler ( struct connection_handler_args ) { @@ -115,10 +116,12 @@ class oldChannelNotify * oldChannelNotify::pOldChannelNotify () void * oldChannelNotify::operator new ( size_t size ) { + epicsAutoMutex locker ( oldChannelNotify::freeListMutex ); return oldChannelNotify::freeList.allocate ( size ); } void oldChannelNotify::operator delete ( void *pCadaver, size_t size ) { + epicsAutoMutex locker ( oldChannelNotify::freeListMutex ); oldChannelNotify::freeList.release ( pCadaver, size ); } diff --git a/src/ca/oldSubscription.cpp b/src/ca/oldSubscription.cpp index 38033a05c..71d3f65b1 100644 --- a/src/ca/oldSubscription.cpp +++ b/src/ca/oldSubscription.cpp @@ -14,6 +14,7 @@ #include "oldAccess.h" tsFreeList < struct oldSubscription, 1024 > oldSubscription::freeList; +epicsMutex oldSubscription::freeListMutex; oldSubscription::~oldSubscription () { diff --git a/src/ca/putCallback.cpp b/src/ca/putCallback.cpp index 9f05e4f64..93619234d 100644 --- a/src/ca/putCallback.cpp +++ b/src/ca/putCallback.cpp @@ -19,6 +19,7 @@ #include "oldAccess.h" tsFreeList < class putCallback, 1024 > putCallback::freeList; +epicsMutex putCallback::freeListMutex; putCallback::~putCallback () { diff --git a/src/ca/repeater.cpp b/src/ca/repeater.cpp index 69e682ecf..3fe3b901c 100644 --- a/src/ca/repeater.cpp +++ b/src/ca/repeater.cpp @@ -57,12 +57,6 @@ #include "iocinf.h" #include "taskwd.h" -#ifdef DEBUG -# define debugPrintf(argsInParen) printf argsInParen -#else -# define debugPrintf(argsInParen) -#endif - /* * one socket per client so we will get the ECONNREFUSED * error code (and then delete the client) @@ -86,6 +80,7 @@ private: SOCKET sock; unsigned port () const; static tsFreeList < class repeaterClient, 0x20 > freeList; + static epicsMutex freeListMutex; }; /* @@ -94,6 +89,7 @@ private: */ static tsDLList < repeaterClient > client_list; tsFreeList < repeaterClient, 0x20 > repeaterClient::freeList; +epicsMutex repeaterClient::freeListMutex; static char buf [MAX_UDP_RECV]; @@ -246,11 +242,13 @@ repeaterClient::~repeaterClient () inline void * repeaterClient::operator new ( size_t size ) { + epicsAutoMutex locker ( repeaterClient::freeListMutex ); return repeaterClient::freeList.allocate ( size ); } inline void repeaterClient::operator delete ( void *pCadaver, size_t size ) { + epicsAutoMutex locker ( repeaterClient::freeListMutex ); repeaterClient::freeList.release ( pCadaver, size ); }