From af42d394b9ad3340d28755039c527768bfe35cf7 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 3 Oct 2001 22:38:53 +0000 Subject: [PATCH] fixed proper shutdown of local CA subscriptions --- src/db/dbCAC.h | 1 + src/db/dbServiceIO.cpp | 3 +++ src/db/dbSubscriptionIO.cpp | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/db/dbCAC.h b/src/db/dbCAC.h index f0077e7dc..5fdcc4450 100644 --- a/src/db/dbCAC.h +++ b/src/db/dbCAC.h @@ -72,6 +72,7 @@ public: dbSubscriptionIO ( dbServiceIO &, dbChannelIO &, struct dbAddr &, cacStateNotify &, unsigned type, unsigned long count, unsigned mask, cacChannel::ioid * ); void destroy (); + void channelDestroyException (); void show ( unsigned level ) const; void * operator new ( size_t size ); void operator delete ( void *pCadaver, size_t size ); diff --git a/src/db/dbServiceIO.cpp b/src/db/dbServiceIO.cpp index 6fd9de628..25be69de5 100644 --- a/src/db/dbServiceIO.cpp +++ b/src/db/dbServiceIO.cpp @@ -263,6 +263,9 @@ void dbServiceIO::destroyAllIO ( dbChannelIO & chan ) } } while ( ( pIO = tmp.get() ) ) { + // If they call ioCancel() here it will be ignored + // because the IO has been unregistered above + pIO->channelDestroyException (); pIO->destroy (); } if ( chan.dbServicePrivateListOfIO::pBlocker ) { diff --git a/src/db/dbSubscriptionIO.cpp b/src/db/dbSubscriptionIO.cpp index 5685985a0..94d36712e 100644 --- a/src/db/dbSubscriptionIO.cpp +++ b/src/db/dbSubscriptionIO.cpp @@ -57,8 +57,6 @@ dbSubscriptionIO::~dbSubscriptionIO () if ( this->es ) { db_cancel_event ( this->es ); } - this->notify.exception ( ECA_CHANDESTROY, - this->chan.pName(), this->type, this->count ); } void dbSubscriptionIO::destroy () @@ -66,6 +64,12 @@ void dbSubscriptionIO::destroy () delete this; } +void dbSubscriptionIO::channelDestroyException () +{ + this->notify.exception ( ECA_CHANDESTROY, + this->chan.pName(), this->type, this->count ); +} + void * dbSubscriptionIO::operator new ( size_t size ) { epicsAutoMutex locker ( dbSubscriptionIO::freeListMutex );