From 2ed228e2f734f6a2ea830150420d7915f8c91cbc Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 20 Dec 2002 02:28:41 +0000 Subject: [PATCH] o added try/catch around event allocation o removed copy operator use from ovf event swap however Im not sure this will help --- src/cas/generic/casMonitor.cc | 39 +++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/cas/generic/casMonitor.cc b/src/cas/generic/casMonitor.cc index c80fc68ff..a5d75ee5e 100644 --- a/src/cas/generic/casMonitor.cc +++ b/src/cas/generic/casMonitor.cc @@ -108,36 +108,43 @@ void casMonitor::push ( const smartConstGDDPointer & pNewValue ) || client.eventSysIsFull (); casMonEvent * pLog; if ( ! full ) { - pLog = & client.casMonEventFactory ( *this, pNewValue ); - if ( pLog ) { + try { + // I should get rid of this try block by implementing a no + // throw version of the free list alloc + pLog = & client.casMonEventFactory ( *this, pNewValue ); this->nPend++; // X aCC 818 - } + } + catch ( ... ) { + pLog = 0; + } } else { - pLog = NULL; + pLog = 0; } if ( this->ovf ) { if ( pLog ) { - // // swap values - // (ugly - but avoids purify ukn sym type problem) - // (better to create a temp event object) - // - smartConstGDDPointer pValue = this->overFlowEvent.getValue (); - if ( ! pValue ) { - assert ( 0 ); + smartConstGDDPointer pOldValue = this->overFlowEvent.getValue (); + if ( ! pOldValue ) { + assert ( 0 ); // due to limitations in class smartConstGDDPointer } - this->overFlowEvent = *pLog; - pLog->assign ( *this, pValue ); + // copy old OVF value into the new entry which must remain + // ordered in the queue where the OVF entry was before + pLog->assign ( *this, pOldValue ); + // copy new value into OVF event entry which must be last + this->overFlowEvent.assign ( *this, *pNewValue ); + // this inserts it out of order, but this is fixed below when the + // overflow event is removed from the queue client.insertEventQueue ( *pLog, this->overFlowEvent ); } else { - // - // replace the value with the current one - // + // replace the old OVF value with the current one this->overFlowEvent.assign ( *this, pNewValue ); } + // remove OVF entry (with its new value) from the queue so + // that it ends up properly ordered at the back of the + // queue client.removeFromEventQueue ( this->overFlowEvent ); pLog = & this->overFlowEvent; }