From 2e329813aa0b3b70f0dc45e27cc55205e01fa0ea Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 21 Sep 2001 17:09:55 +0000 Subject: [PATCH] fixed possible race condition where put notify block might be nilled out while it is running --- src/db/dbCAC.h | 3 --- src/db/dbChannelIO.cpp | 5 ----- src/db/dbPutNotifyBlocker.cpp | 11 ++--------- src/db/dbServiceIO.cpp | 6 ------ 4 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/db/dbCAC.h b/src/db/dbCAC.h index a0967bbf1..474ed74b3 100644 --- a/src/db/dbCAC.h +++ b/src/db/dbCAC.h @@ -47,7 +47,6 @@ public: void initiatePutNotify ( epicsMutex &mutex, cacWriteNotify ¬ify, struct dbAddr &addr, unsigned type, unsigned long count, const void *pValue ); void cancel (); - void completion (); void show ( unsigned level ) const; void * operator new ( size_t size ); void operator delete ( void *pCadaver, size_t size ); @@ -113,7 +112,6 @@ public: cacReadNotify ¬ify ); void callStateNotify ( unsigned type, unsigned long count, const struct db_field_log *pfl, cacStateNotify ¬ify ); - void putNotifyCompletion ( dbPutNotifyBlocker & ); void show ( unsigned level ) const; void * operator new ( size_t size); void operator delete ( void *pCadaver, size_t size ); @@ -156,7 +154,6 @@ public: void initiatePutNotify ( dbChannelIO &, struct dbAddr &, unsigned type, unsigned long count, const void *pValue, cacWriteNotify ¬ify, cacChannel::ioid *pId ); - void putNotifyCompletion ( dbPutNotifyBlocker & ); void show ( unsigned level ) const; void showAllIO ( const dbChannelIO &chan, unsigned level ) const; void destroyAllIO ( dbChannelIO & chan ); diff --git a/src/db/dbChannelIO.cpp b/src/db/dbChannelIO.cpp index c355f4e6d..cc722c317 100644 --- a/src/db/dbChannelIO.cpp +++ b/src/db/dbChannelIO.cpp @@ -83,11 +83,6 @@ cacChannel::ioStatus dbChannelIO::write ( unsigned type, unsigned long count, return iosAsynch; } -void dbChannelIO::putNotifyCompletion ( dbPutNotifyBlocker &blocker ) -{ - this->serviceIO.putNotifyCompletion ( blocker ); -} - void dbChannelIO::subscribe ( unsigned type, unsigned long count, unsigned mask, cacStateNotify ¬ify, ioid *pId ) { diff --git a/src/db/dbPutNotifyBlocker.cpp b/src/db/dbPutNotifyBlocker.cpp index a9c067ecc..bbc2de958 100644 --- a/src/db/dbPutNotifyBlocker.cpp +++ b/src/db/dbPutNotifyBlocker.cpp @@ -88,19 +88,12 @@ extern "C" void putNotifyCompletion ( putNotify *ppn ) } } else { - errlogPrintf ( "put notify completion pNotify = %p?\n", pBlocker->pNotify ); + errlogPrintf ( "put notify completion with nill pNotify?\n" ); } + // no need to lock here because only one put notify at a timeis lalowed to run memset ( &pBlocker->pn, '\0', sizeof ( pBlocker->pn ) ); pBlocker->pNotify = 0; pBlocker->block.signal (); - pBlocker->chan.putNotifyCompletion ( *pBlocker ); -} - -void dbPutNotifyBlocker::completion () -{ - memset ( &this->pn, '\0', sizeof ( this->pn ) ); - this->pNotify = 0; - this->block.signal (); } void dbPutNotifyBlocker::initiatePutNotify ( epicsMutex &mutex, cacWriteNotify ¬ify, diff --git a/src/db/dbServiceIO.cpp b/src/db/dbServiceIO.cpp index 2e062f5da..28d664bc5 100644 --- a/src/db/dbServiceIO.cpp +++ b/src/db/dbServiceIO.cpp @@ -255,12 +255,6 @@ void dbServiceIO::initiatePutNotify ( dbChannelIO &chan, struct dbAddr &addr, } } -void dbServiceIO::putNotifyCompletion ( dbPutNotifyBlocker &blocker ) -{ - epicsAutoMutex locker ( this->mutex ); - blocker.completion (); -} - void dbServiceIO::destroyAllIO ( dbChannelIO & chan ) { dbSubscriptionIO *pIO;