revert to using virtual destroy() to destroy timers

This commit is contained in:
Jeff Hill
2001-07-12 17:53:51 +00:00
parent b061bb6eb9
commit c61e68b4e3
22 changed files with 37 additions and 63 deletions

View File

@@ -30,7 +30,7 @@ repeaterSubscribeTimer::repeaterSubscribeTimer ( udpiiu &iiuIn, epicsTimerQueue
repeaterSubscribeTimer::~repeaterSubscribeTimer ()
{
this->timer.getQueue().destroyTimer ( this->timer );
this->timer.destroy ();
}
epicsTimerNotify::expireStatus repeaterSubscribeTimer::expire ( const epicsTime & currentTime )

View File

@@ -57,7 +57,7 @@ searchTimer::searchTimer ( udpiiu &iiuIn, epicsTimerQueue &queueIn, epicsMutex &
searchTimer::~searchTimer ()
{
this->timer.getQueue().destroyTimer ( this->timer );
this->timer.destroy ();
}
//

View File

@@ -28,7 +28,7 @@ tcpRecvWatchdog::tcpRecvWatchdog
tcpRecvWatchdog::~tcpRecvWatchdog ()
{
this->timer.getQueue().destroyTimer ( this->timer );
this->timer.destroy ();
}
epicsTimerNotify::expireStatus tcpRecvWatchdog::expire ( const epicsTime & /* currentTime */ )

View File

@@ -24,7 +24,7 @@ tcpSendWatchdog::tcpSendWatchdog
tcpSendWatchdog::~tcpSendWatchdog ()
{
this->timer.getQueue().destroyTimer ( this->timer );
this->timer.destroy ();
}
epicsTimerNotify::expireStatus tcpSendWatchdog::expire ( const epicsTime & currentTime )

View File

@@ -68,7 +68,7 @@ exAsyncWriteIO::~exAsyncWriteIO()
{
this->pv.removeIO();
if ( this->pv.getCAS() ) {
this->pv.getCAS()->destroyTimer ( this->timer );
this->timer.destroy ();
}
}
@@ -102,7 +102,7 @@ exAsyncReadIO::~exAsyncReadIO()
{
this->pv.removeIO ();
if ( this->pv.getCAS() ) {
this->pv.getCAS()->destroyTimer ( this->timer );
this->timer.destroy ();
}
}

View File

@@ -49,7 +49,7 @@ exPV::exPV ( pvInfo &setup, bool preCreateFlag, bool scanOnIn ) :
exPV::~exPV()
{
if ( this->getCAS() ) {
this->getCAS()->destroyTimer ( this->timer );
this->timer.destroy ();
}
this->info.unlinkPV();
}

View File

@@ -329,7 +329,7 @@ exAsyncExistIO::exAsyncExistIO ( const pvInfo &pviIn, const casCtx &ctxIn,
exAsyncExistIO::~exAsyncExistIO()
{
this->cas.removeIO ();
this->cas.destroyTimer ( this->timer );
this->timer.destroy ();
}
//
@@ -364,7 +364,7 @@ exAsyncCreateIO::exAsyncCreateIO ( pvInfo &pviIn, exServer &casIn,
exAsyncCreateIO::~exAsyncCreateIO()
{
this->cas.removeIO ();
this->cas.destroyTimer ( this->timer );
this->timer.destroy ();
}
//

View File

@@ -213,11 +213,6 @@ class epicsTimer & caServer::createTimer ()
return fileDescriptorManager.createTimer ();
}
void caServer::destroyTimer ( class epicsTimer & tmr )
{
fileDescriptorManager.destroyTimer ( tmr );
}
//
// caServer::readEventsProcessedCounter
//

View File

@@ -374,7 +374,6 @@ public:
#endif
epicsShareFunc class epicsTimer & createTimer ();
epicsShareFunc void destroyTimer ( class epicsTimer & );
//caStatus enableClients ();
//caStatus disableClients ();

View File

@@ -34,7 +34,7 @@ casBeaconTimer::casBeaconTimer ( double delay, caServerOS &osIn ) :
casBeaconTimer::~casBeaconTimer ()
{
fileDescriptorManager.destroyTimer ( this->timer );
this->timer.destroy ();
}
//

View File

@@ -100,7 +100,7 @@ casDGEvWakeup::casDGEvWakeup () :
//
casDGEvWakeup::~casDGEvWakeup()
{
fileDescriptorManager.destroyTimer ( this->timer );
this->timer.destroy ();
}
void casDGEvWakeup::start ( casDGIntfOS &os )
@@ -148,7 +148,7 @@ casDGIOWakeup::casDGIOWakeup () :
//
casDGIOWakeup::~casDGIOWakeup()
{
fileDescriptorManager.destroyTimer ( this->timer );
this->timer.destroy ();
}
//

View File

@@ -117,7 +117,7 @@ casStreamEvWakeup::casStreamEvWakeup () :
//
casStreamEvWakeup::~casStreamEvWakeup()
{
fileDescriptorManager.destroyTimer ( this->timer );
this->timer.destroy ();
}
//
@@ -185,7 +185,7 @@ casStreamIOWakeup::casStreamIOWakeup () :
//
casStreamIOWakeup::~casStreamIOWakeup()
{
fileDescriptorManager.destroyTimer ( this->timer );
this->timer.deatroy ();
}
//

View File

@@ -103,7 +103,6 @@ public:
epicsShareFunc class fdReg *lookUpFD (const SOCKET fd, const fdRegType type);
epicsTimer & createTimer ();
void destroyTimer ( epicsTimer & );
private:
tsDLList<fdReg> regList;
@@ -212,10 +211,5 @@ inline epicsTimer & fdManager::createTimer ()
return this->pTimerQueue->createTimer ();
}
inline void fdManager::destroyTimer ( epicsTimer & tmr )
{
this->pTimerQueue->destroyTimer ( tmr );
}
#endif // fdManagerH_included

View File

@@ -135,7 +135,7 @@ timerForOldFdmgr::timerForOldFdmgr ( oldFdmgr &fdmgrIn,
timerForOldFdmgr::~timerForOldFdmgr ()
{
this->fdmgr.resTbl.remove ( this->getId() );
this->fdmgr.destroyTimer ( this->timer );
this->timer.destroy ();
}
epicsTimerNotify::expireStatus timerForOldFdmgr::expire ( const epicsTime & )

View File

@@ -68,7 +68,7 @@ delayVerify::delayVerify ( double expectedDelayIn, epicsTimerQueue &queueIn ) :
delayVerify::~delayVerify ()
{
this->timer.getQueue().destroyTimer ( this->timer );
this->timer.destroy ();
}
inline void delayVerify::setBegin ( const epicsTime &beginIn )
@@ -177,7 +177,7 @@ cancelVerify::cancelVerify ( epicsTimerQueue &queueIn ) :
cancelVerify::~cancelVerify ()
{
this->timer.getQueue().destroyTimer ( this->timer );
this->timer.destroy ();
}
inline void cancelVerify::start ( const epicsTime &expireTime )
@@ -271,7 +271,7 @@ periodicVerify::periodicVerify ( epicsTimerQueue & queueIn ) :
periodicVerify::~periodicVerify ()
{
this->timer.getQueue().destroyTimer ( this->timer );
this->timer.destroy ();
}
inline void periodicVerify::start ( const epicsTime &expireTime )

View File

@@ -50,6 +50,8 @@ private:
epicsTimer::~epicsTimer () {}
epicsTimerQueueNotify::~epicsTimerQueueNotify () {}
void epicsTimerNotify::show ( unsigned /* level */ ) const {}
epicsTimerForC::epicsTimerForC ( timerQueue &queue, epicsTimerCallback pCBIn, void *pPrivateIn ) :

View File

@@ -46,7 +46,7 @@ public:
class epicsTimer {
public:
virtual ~epicsTimer () = 0;
virtual void destroy () = 0; // requires existence of timer queue
virtual void start ( epicsTimerNotify &, const epicsTime & ) = 0;
virtual void start ( epicsTimerNotify &, double delaySeconds ) = 0;
virtual void cancel () = 0;
@@ -58,23 +58,25 @@ public:
virtual expireInfo getExpireInfo () const = 0;
double getExpireDelay ();
virtual void show ( unsigned int level ) const = 0;
virtual class epicsTimerQueue & getQueue () const = 0;
protected:
virtual ~epicsTimer () = 0; // use destroy
};
class epicsTimerQueue {
public:
virtual ~epicsTimerQueue () = 0;
virtual epicsTimer & createTimer () = 0;
virtual void destroyTimer ( epicsTimer & ) = 0;
virtual void show ( unsigned int level ) const = 0;
protected:
virtual ~epicsTimerQueue () = 0;
};
class epicsTimerQueueActive : public epicsTimerQueue {
public:
virtual ~epicsTimerQueueActive () = 0;
static epicsShareFunc epicsTimerQueueActive & allocate (
bool okToShare, int threadPriority = epicsThreadPriorityMin + 10 );
virtual void release () = 0;
protected:
virtual ~epicsTimerQueueActive () = 0;
};
class epicsTimerQueueNotify {
@@ -82,6 +84,8 @@ public:
// called when a new timer is inserted into the queue and the
// delay to the next expire has changed
virtual void reschedule () = 0;
protected:
virtual ~epicsTimerQueueNotify () = 0;
};
class epicsTimerQueuePassive : public epicsTimerQueue {

View File

@@ -42,6 +42,13 @@ timer::~timer ()
this->cancel ();
}
void timer::destroy ()
{
epicsAutoMutex autoLock ( this->queue.mutex );
this->~timer ();
this->queue.timerFreeList.release ( this, sizeof( *this ) );
}
void timer::start ( epicsTimerNotify & notify, double delaySeconds )
{
this->start ( notify, epicsTime::getCurrent () + delaySeconds );
@@ -177,11 +184,6 @@ void timer::show ( unsigned int level ) const
}
}
epicsTimerQueue & timer::getQueue () const
{
return this->queue;
}
timerQueue & timer::getPrivTimerQueue()
{
return this->queue;

View File

@@ -43,12 +43,12 @@
class timer : public epicsTimer, public tsDLNode < timer > {
public:
void destroy ();
void start ( class epicsTimerNotify &, const epicsTime & );
void start ( class epicsTimerNotify &, double delaySeconds );
void cancel ();
expireInfo getExpireInfo () const;
void show ( unsigned int level ) const;
epicsTimerQueue & getQueue () const;
class timerQueue & getPrivTimerQueue ();
protected:
timer ( class timerQueue & );
@@ -83,7 +83,6 @@ public:
virtual ~timerQueue ();
double process ( const epicsTime & currentTime );
epicsTimer & createTimer ();
void destroyTimer ( epicsTimer & );
void show ( unsigned int level ) const;
epicsTimerForC & createTimerForC ( epicsTimerCallback, void *pPrivateIn );
void destroyTimerForC ( epicsTimerForC & );
@@ -117,7 +116,6 @@ public:
timerQueueActive ( bool okToShare, unsigned priority );
~timerQueueActive () = 0;
epicsTimer & createTimer ();
void destroyTimer ( epicsTimer & );
void show ( unsigned int level ) const;
bool sharingOK () const;
int threadPriority () const;
@@ -167,7 +165,6 @@ class timerQueuePassive : public epicsTimerQueuePassive {
public:
timerQueuePassive ( epicsTimerQueueNotify & );
epicsTimer & createTimer ();
void destroyTimer ( epicsTimer & );
void show ( unsigned int level ) const;
double process ( const epicsTime & currentTime );
epicsTimerForC & createTimerForC ( epicsTimerCallback, void *pPrivateIn );

View File

@@ -163,13 +163,6 @@ epicsTimer & timerQueue::createTimer ()
return * new ( pBuf ) timer ( *this );
}
void timerQueue::destroyTimer ( epicsTimer & tmr )
{
epicsAutoMutex autoLock ( this->mutex );
tmr.~epicsTimer ();
this->timerFreeList.release ( &tmr, sizeof( tmr ) );
}
void timerQueue::show ( unsigned level ) const
{
epicsAutoMutex locker ( this->mutex );

View File

@@ -76,12 +76,6 @@ epicsTimer & timerQueueActive::createTimer ()
return this->queue.createTimer ();
}
void timerQueueActive::destroyTimer ( epicsTimer & et )
{
timer & tmr = dynamic_cast < timer & > ( et );
this->queue.destroyTimer ( tmr );
}
epicsTimerForC & timerQueueActive::createTimerForC ( epicsTimerCallback pCB, void *pPrivateIn )
{
return this->queue.createTimerForC ( pCB, pPrivateIn );

View File

@@ -60,12 +60,6 @@ epicsTimer & timerQueuePassive::createTimer ()
return this->queue.createTimer ();
}
void timerQueuePassive::destroyTimer ( epicsTimer & et )
{
timer & tmr = dynamic_cast < timer & > ( et );
this->queue.destroyTimer ( tmr );
}
epicsTimerForC & timerQueuePassive::createTimerForC ( epicsTimerCallback pCB, void *pPrivateIn )
{
return this->queue.createTimerForC ( pCB, pPrivateIn );