diff --git a/src/ca/CASG.cpp b/src/ca/CASG.cpp index 85fbfecbd..0c1170179 100644 --- a/src/ca/CASG.cpp +++ b/src/ca/CASG.cpp @@ -42,6 +42,8 @@ void CASG::destructor ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); + if ( this->verify ( guard ) ) { this->reset ( cbGuard, guard ); this->client.uninstallCASG ( guard, *this ); @@ -72,6 +74,8 @@ int CASG::block ( double remaining; int status; + guard.assertIdenticalMutex ( this->client.mutexRef() ); + // prevent recursion nightmares by disabling blocking // for IO from within a CA callback. if ( epicsThreadPrivateGet ( caClientCallbackThreadId ) ) { @@ -128,6 +132,7 @@ void CASG::reset ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); this->destroyCompletedIO ( guard ); this->destroyPendingIO ( cbGuard, guard ); } @@ -136,6 +141,7 @@ void CASG::reset ( void CASG::destroyCompletedIO ( epicsGuard < epicsMutex > & guard ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); syncGroupNotify * pNotify; while ( ( pNotify = this->ioCompletedList.get () ) ) { pNotify->destroy ( guard, * this ); @@ -146,6 +152,7 @@ void CASG::destroyPendingIO ( epicsGuard < epicsMutex > & cbGuard, epicsGuard < epicsMutex > & guard ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); syncGroupNotify * pNotify; while ( ( pNotify = this->ioPendingList.first () ) ) { pNotify->cancel ( cbGuard, guard ); @@ -171,6 +178,7 @@ void CASG::show ( unsigned level ) const void CASG::show ( epicsGuard < epicsMutex > & guard, unsigned level ) const { + guard.assertIdenticalMutex ( this->client.mutexRef() ); ::printf ( "Sync Group: id=%u, magic=%u, opPend=%u\n", this->getId (), this->magic, this->ioPendingList.count () ); if ( level ) { @@ -192,9 +200,10 @@ void CASG::show ( } bool CASG::ioComplete ( - epicsGuard < epicsMutex > & cbGuard, + epicsGuard < epicsMutex > & /* cbGuard */, epicsGuard < epicsMutex > & guard ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); this->destroyCompletedIO ( guard ); return this->ioPendingList.count () == 0u; } @@ -202,6 +211,7 @@ bool CASG::ioComplete ( void CASG::put ( epicsGuard < epicsMutex > & guard, chid pChan, unsigned type, arrayElementCount count, const void * pValue ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); sgAutoPtr < syncGroupWriteNotify > pNotify ( guard, *this, this->ioPendingList ); pNotify = syncGroupWriteNotify::factory ( this->freeListWriteOP, *this, pChan ); @@ -212,6 +222,7 @@ void CASG::put ( epicsGuard < epicsMutex > & guard, chid pChan, void CASG::get ( epicsGuard < epicsMutex > & guard, chid pChan, unsigned type, arrayElementCount count, void *pValue ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); sgAutoPtr < syncGroupReadNotify > pNotify ( guard, *this, this->ioPendingList ); pNotify = syncGroupReadNotify::factory ( this->freeListReadOP, *this, pChan, pValue ); @@ -222,6 +233,7 @@ void CASG::get ( epicsGuard < epicsMutex > & guard, chid pChan, void CASG::completionNotify ( epicsGuard < epicsMutex > & guard, syncGroupNotify & notify ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); this->ioPendingList.remove ( notify ); this->ioCompletedList.add ( notify ); if ( this->ioPendingList.count () == 0u ) { @@ -232,12 +244,14 @@ void CASG::completionNotify ( void CASG::recycleSyncGroupWriteNotify ( epicsGuard < epicsMutex > & guard, syncGroupWriteNotify & io ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); this->freeListWriteOP.release ( & io ); } void CASG::recycleSyncGroupReadNotify ( epicsGuard < epicsMutex > & guard, syncGroupReadNotify & io ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); this->freeListReadOP.release ( & io ); } @@ -260,6 +274,7 @@ void CASG::exception ( int status, const char * pContext, const char * pFileName, unsigned lineNo ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); if ( status != ECA_CHANDESTROY ) { this->client.exception ( guard, status, pContext, pFileName, lineNo ); @@ -272,6 +287,7 @@ void CASG::exception ( const char * pFileName, unsigned lineNo, oldChannelNotify & chan, unsigned type, arrayElementCount count, unsigned op ) { + guard.assertIdenticalMutex ( this->client.mutexRef() ); if ( status != ECA_CHANDESTROY ) { this->client.exception ( guard, status, pContext, pFileName, diff --git a/src/ca/casw.cpp b/src/ca/casw.cpp index 3725c55cc..5733205b2 100644 --- a/src/ca/casw.cpp +++ b/src/ca/casw.cpp @@ -35,10 +35,13 @@ // Tornado 2.0.1 GNU compiler bugs class bheFreeStoreMgr : public bheMemoryManager { public: + bheFreeStoreMgr () {} void * allocate ( size_t ); void release ( void * ); private: tsFreeList < class bhe, 0x100 > freeList; + bheFreeStoreMgr ( const bheFreeStoreMgr & ); + bheFreeStoreMgr & operator = ( const bheFreeStoreMgr & ); }; void * bheFreeStoreMgr::allocate ( size_t size ) diff --git a/src/ca/nciu.h b/src/ca/nciu.h index 3e9b0a251..cd23263b4 100644 --- a/src/ca/nciu.h +++ b/src/ca/nciu.h @@ -275,7 +275,7 @@ inline netiiu * nciu::getPIIU ( } inline void nciu::writeException ( - epicsGuard < epicsMutex > & cbGuard, + epicsGuard < epicsMutex > & /* cbGuard */, epicsGuard < epicsMutex > & guard, int status, const char * pContext, unsigned typeIn, arrayElementCount countIn ) diff --git a/src/ca/oldChannelNotify.cpp b/src/ca/oldChannelNotify.cpp index fbf7511f7..f65737d88 100644 --- a/src/ca/oldChannelNotify.cpp +++ b/src/ca/oldChannelNotify.cpp @@ -100,12 +100,14 @@ int oldChannelNotify::changeConnCallBack ( void oldChannelNotify::setPrivatePointer ( epicsGuard < epicsMutex > & guard, void *pPrivateIn ) { + guard.assertIdenticalMutex ( this->cacCtx.mutexRef () ); this->pPrivate = pPrivateIn; } void * oldChannelNotify::privatePointer ( epicsGuard < epicsMutex > & guard ) const { + guard.assertIdenticalMutex ( this->cacCtx.mutexRef () ); return this->pPrivate; } diff --git a/src/ca/sgAutoPtr.h b/src/ca/sgAutoPtr.h index 8727d78aa..acbab6afa 100644 --- a/src/ca/sgAutoPtr.h +++ b/src/ca/sgAutoPtr.h @@ -43,6 +43,7 @@ private: T * pNotify; struct CASG & sg; epicsGuard < epicsMutex > & guard; + sgAutoPtr & operator = ( const sgAutoPtr & ); }; template < class T > diff --git a/src/ca/syncGroup.h b/src/ca/syncGroup.h index 3cbed6deb..6fa29608e 100644 --- a/src/ca/syncGroup.h +++ b/src/ca/syncGroup.h @@ -274,13 +274,13 @@ inline void CASG::operator delete ( void * pCadaver, #endif inline bool syncGroupWriteNotify::ioPending ( - epicsGuard < epicsMutex > & guard ) + epicsGuard < epicsMutex > & /* guard */ ) { return ! this->ioComplete; } inline bool syncGroupReadNotify::ioPending ( - epicsGuard < epicsMutex > & guard ) + epicsGuard < epicsMutex > & /* guard */ ) { return ! this->ioComplete; } diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index 490189932..d12651260 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -1251,7 +1251,8 @@ void tcpiiu::versionMessage ( epicsGuard < epicsMutex > & guard, // X aCC 431 comQueSendMsgMinder minder ( this->sendQue, guard ); this->sendQue.insertRequestHeader ( CA_PROTO_VERSION, 0u, - priority, CA_MINOR_PROTOCOL_REVISION, 0u, 0u, + static_cast < ca_uint16_t > ( priority ), + CA_MINOR_PROTOCOL_REVISION, 0u, 0u, CA_V49 ( this->minorProtocolVersion ) ); minder.commit (); } @@ -1655,7 +1656,7 @@ void tcpiiu::removeAllChannels ( } void tcpiiu::installChannel ( - epicsGuard < epicsMutex > & cbGuard, + epicsGuard < epicsMutex > & /* cbGuard */, epicsGuard < epicsMutex > & guard, nciu & chan, unsigned sidIn, ca_uint16_t typeIn, arrayElementCount countIn ) diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index 984922aaf..f6f211ae6 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -1257,18 +1257,21 @@ void udpiiu::blockUntilSendBacklogIsReasonable ( void udpiiu::requestRecvProcessPostponedFlush ( epicsGuard < epicsMutex > & guard ) { + guard.assertIdenticalMutex ( this->cacMutex ); netiiu::requestRecvProcessPostponedFlush ( guard ); } osiSockAddr udpiiu::getNetworkAddress ( epicsGuard < epicsMutex > & guard ) const { + guard.assertIdenticalMutex ( this->cacMutex ); return netiiu::getNetworkAddress ( guard ); } double udpiiu::receiveWatchdogDelay ( epicsGuard < epicsMutex > & guard ) const { + guard.assertIdenticalMutex ( this->cacMutex ); return - DBL_MAX; }