fixed proper shutdown of local CA subscriptions

This commit is contained in:
Jeff Hill
2001-10-03 23:47:24 +00:00
parent af42d394b9
commit 28ecb1209f
3 changed files with 16 additions and 3 deletions

View File

@@ -72,7 +72,8 @@ public:
dbSubscriptionIO ( dbServiceIO &, dbChannelIO &, struct dbAddr &, cacStateNotify &,
unsigned type, unsigned long count, unsigned mask, cacChannel::ioid * );
void destroy ();
void channelDestroyException ();
void unsubscribe ();
void channelDeleteException ();
void show ( unsigned level ) const;
void * operator new ( size_t size );
void operator delete ( void *pCadaver, size_t size );

View File

@@ -257,6 +257,9 @@ void dbServiceIO::destroyAllIO ( dbChannelIO & chan )
while ( ( pIO = chan.dbServicePrivateListOfIO::eventq.get() ) ) {
this->ioTable.remove ( *pIO );
tmp.add ( *pIO );
// this prevents a db event callback from coming
// through after the IO is deleted
pIO->unsubscribe ();
}
if ( chan.dbServicePrivateListOfIO::pBlocker ) {
this->ioTable.remove ( *chan.dbServicePrivateListOfIO::pBlocker );
@@ -265,7 +268,7 @@ 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->channelDeleteException ();
pIO->destroy ();
}
if ( chan.dbServicePrivateListOfIO::pBlocker ) {

View File

@@ -64,7 +64,16 @@ void dbSubscriptionIO::destroy ()
delete this;
}
void dbSubscriptionIO::channelDestroyException ()
// lock should be applied
void dbSubscriptionIO::unsubscribe ()
{
if ( this->es ) {
db_cancel_event ( this->es );
this->es = 0;
}
}
void dbSubscriptionIO::channelDeleteException ()
{
this->notify.exception ( ECA_CHANDESTROY,
this->chan.pName(), this->type, this->count );