diff --git a/src/cas/generic/casCoreClient.cc b/src/cas/generic/casCoreClient.cc index 0004d7468..833c40e04 100644 --- a/src/cas/generic/casCoreClient.cc +++ b/src/cas/generic/casCoreClient.cc @@ -219,7 +219,7 @@ void casCoreClient::postEvent ( tsDLList < casMonitor > & monitorList, epicsGuard < epicsMutex > guard ( this->mutex ); tsDLIter < casMonitor > iter = monitorList.firstIter (); while ( iter.valid () ) { - iter->postEvent ( select, event ); + iter->postEvent ( this->eventSys, select, event ); ++iter; } } @@ -296,12 +296,6 @@ caStatus casCoreClient::addToEventQueue ( casAsyncIOI & io, return S_cas_success; } -void casCoreClient::insertEventQueue ( casEvent & insert, casEvent & prevEvent ) -{ - epicsGuard < epicsMutex > guard ( this->mutex ); - this->eventSys.insertEventQueue ( insert, prevEvent ); -} - void casCoreClient::removeFromEventQueue ( casEvent & ev ) { epicsGuard < epicsMutex > guard ( this->mutex ); @@ -337,10 +331,5 @@ void casCoreClient::setDestroyPending () this->eventSys.setDestroyPending (); } -bool casCoreClient::eventSysIsFull () -{ - epicsGuard < epicsMutex > guard ( this->mutex ); - return this->eventSys.full (); -} diff --git a/src/cas/generic/casInternal.h b/src/cas/generic/casInternal.h index 8652c3bce..c4a508bc7 100644 --- a/src/cas/generic/casInternal.h +++ b/src/cas/generic/casInternal.h @@ -145,7 +145,9 @@ public: caStatus executeEvent ( casMonEvent & ); - void postEvent ( const casEventMask & select, const smartConstGDDPointer & pValue ); + void postEvent ( class casEventSys & evSys, + const casEventMask & select, + const smartConstGDDPointer & pValue ); caResId getClientId () const { @@ -185,7 +187,7 @@ private: void enable (); void disable (); casResType resourceType () const; - void push ( const smartConstGDDPointer & pValue ); + void push ( casEventSys & evSys, const smartConstGDDPointer & pValue ); void * operator new ( size_t ); void operator delete ( void * ); casMonitor ( const casMonitor & ); @@ -196,21 +198,23 @@ private: // casMonitor::postEvent() // (check for NOOP case in line) // -inline void casMonitor::postEvent (const casEventMask &select, const smartConstGDDPointer &pValue) +inline void casMonitor::postEvent ( casEventSys & evSys, + const casEventMask & select, const smartConstGDDPointer & pValue) { - casEventMask result (select&this->mask); + casEventMask result ( select & this->mask ); + // // NOOP if this event isnt selected // or if it is disabled // - if ( result.noEventsSelected() || !this->enabled ) { + if ( result.noEventsSelected() || ! this->enabled ) { return; } // // else push it on the queue // - this->push (pValue); + this->push ( evSys, pValue ); } class caServer; diff --git a/src/cas/generic/casMonitor.cc b/src/cas/generic/casMonitor.cc index fb5db7f94..fc1210208 100644 --- a/src/cas/generic/casMonitor.cc +++ b/src/cas/generic/casMonitor.cc @@ -89,7 +89,8 @@ void casMonitor::disable() // // casMonitor::push() // -void casMonitor::push ( const smartConstGDDPointer & pNewValue ) +void casMonitor::push ( casEventSys & evSys, + const smartConstGDDPointer & pNewValue ) { casCoreClient & client = this->ciu.getClient (); client.getCAS().incrEventsPostedCounter (); @@ -97,14 +98,14 @@ void casMonitor::push ( const smartConstGDDPointer & pNewValue ) // // get a new block if we havent exceeded quotas // - bool full = ( this->nPend >= individualEventEntries ) - || client.eventSysIsFull (); + bool full = ( this->nPend >= individualEventEntries ) || evSys.full (); casMonEvent * pLog; if ( ! full ) { 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 ); + assert ( this->nPend != UCHAR_MAX ); this->nPend++; // X aCC 818 } catch ( ... ) { @@ -129,7 +130,7 @@ void casMonitor::push ( const smartConstGDDPointer & pNewValue ) 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 ); + evSys.insertEventQueue ( *pLog, this->overFlowEvent ); } else { // replace the old OVF value with the current one @@ -138,7 +139,7 @@ void casMonitor::push ( const smartConstGDDPointer & 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 ); + evSys.removeFromEventQueue ( this->overFlowEvent ); pLog = & this->overFlowEvent; } else if ( ! pLog ) { @@ -148,11 +149,12 @@ void casMonitor::push ( const smartConstGDDPointer & pNewValue ) // this->ovf = true; this->overFlowEvent.assign ( * this, pNewValue ); + assert ( this->nPend != UCHAR_MAX ); this->nPend++; // X aCC 818 pLog = &this->overFlowEvent; } - client.addToEventQueue ( * pLog ); + evSys.addToEventQueue ( * pLog ); } // @@ -183,6 +185,7 @@ caStatus casMonitor::executeEvent ( casMonEvent & ev ) // // decrement the count of the number of events pending // + assert ( this->nPend != 0u ); this->nPend--; // X aCC 818 // diff --git a/src/cas/generic/server.h b/src/cas/generic/server.h index 47f832e6a..4b3b94de9 100644 --- a/src/cas/generic/server.h +++ b/src/cas/generic/server.h @@ -479,13 +479,10 @@ public: void addToEventQueue ( casEvent & ); caStatus addToEventQueue ( casAsyncIOI &, bool & onTheQueue, bool & posted ); - void insertEventQueue ( casEvent & insert, - casEvent & prevEvent ); void removeFromEventQueue ( casEvent & ); void removeFromEventQueue ( casAsyncIOI & ); void enableEvents (); void disableEvents (); - bool eventSysIsFull (); void setDestroyPending ();