fix for a potential race in ca_context_destroy

This commit is contained in:
Jeff Hill
2006-02-13 16:33:46 +00:00
parent 85eacf584c
commit ceb11f1fb4

View File

@@ -236,22 +236,24 @@ cac::~cac ()
// lock intentionally not held here so that we dont deadlock
// waiting for the UDP thread to exit while it is waiting to
// get the lock.
if ( this->pudpiiu ) {
{
epicsGuard < epicsMutex > cbGuard ( this->cbMutex );
epicsGuard < epicsMutex > guard ( this->mutex );
this->pudpiiu->shutdown ( cbGuard, guard );
//
// shutdown all tcp circuits
//
tsDLIter < tcpiiu > iter = this->circuitList.firstIter ();
while ( iter.valid() ) {
// this causes a clean shutdown to occur
iter->unlinkAllChannels ( cbGuard, guard );
iter++;
if ( this->pudpiiu ) {
this->pudpiiu->shutdown ( cbGuard, guard );
//
// shutdown all tcp circuits
//
tsDLIter < tcpiiu > iter = this->circuitList.firstIter ();
while ( iter.valid() ) {
// this causes a clean shutdown to occur
iter->unlinkAllChannels ( cbGuard, guard );
iter++;
}
}
}
//
// wait for all tcp threads to exit
//
@@ -1169,10 +1171,10 @@ void cac::destroyIIU ( tcpiiu & iiu )
epicsGuard < epicsMutex > guard ( this->mutex );
this->freeListVirtualCircuit.release ( & iiu );
this->iiuUninstallInProgress = false;
// signal iiu uninstal event so that cac can properly shut down
this->iiuUninstall.signal();
}
// signal iiu uninstal event so that cac can properly shut down
this->iiuUninstall.signal();
// do not touch "this" after lock is released above
}
double cac::beaconPeriod (