From 9e49e0131f20b40866d0653cef36577ae3bebcde Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 14 Jul 2009 22:51:06 +0000 Subject: [PATCH] fix for mantis 348 --- src/cas/generic/casStrmClient.cc | 9 ++++++++- src/cas/generic/ioBlocked.h | 6 ++++++ src/cas/generic/st/casStreamOS.cc | 1 + src/cas/generic/st/ioBlocked.cc | 7 ++----- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index 3d0f7e411..cc7d4eac4 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -116,6 +116,13 @@ caStatus casStrmClient::processMsg () { epicsGuard < casClientMutex > guard ( this->mutex ); int status = S_cas_success; + + // protect against service returning s_casApp_success when it + // returned S_casApp_postponeAsyncIO before, but no + // asyn IO completed since the last attempt + if ( this->isBlocked () ) { + return S_casApp_postponeAsyncIO; + } try { @@ -457,7 +464,7 @@ caStatus casStrmClient::readAction ( epicsGuard < casClientMutex > & guard ) return this->sendErr ( guard, mp, pChan->getCID(), status, "read access denied" ); } - + const gdd * pDesc = 0; status = this->read ( pDesc ); if ( status == S_casApp_success ) { diff --git a/src/cas/generic/ioBlocked.h b/src/cas/generic/ioBlocked.h index b2c684123..919f9f2e8 100644 --- a/src/cas/generic/ioBlocked.h +++ b/src/cas/generic/ioBlocked.h @@ -36,6 +36,7 @@ friend class ioBlockedList; public: ioBlocked (); virtual ~ioBlocked (); + bool isBlocked (); private: class ioBlockedList * pList; virtual void ioBlockedSignal (); @@ -52,5 +53,10 @@ public: ioBlockedList & operator = ( const ioBlockedList & ); }; +inline bool ioBlocked :: isBlocked () +{ + return this->pList != NULL; +} + #endif // ioBlockedh diff --git a/src/cas/generic/st/casStreamOS.cc b/src/cas/generic/st/casStreamOS.cc index 3a142327a..d5a74d09e 100644 --- a/src/cas/generic/st/casStreamOS.cc +++ b/src/cas/generic/st/casStreamOS.cc @@ -217,6 +217,7 @@ void casStreamIOWakeup::show ( unsigned level ) const // epicsTimerNotify::expireStatus casStreamIOWakeup::expire ( const epicsTime & /* currentTime */ ) { + assert ( this->pOS ); casStreamOS & tmpOS = *this->pOS; this->pOS = 0; tmpOS.processInput(); diff --git a/src/cas/generic/st/ioBlocked.cc b/src/cas/generic/st/ioBlocked.cc index d3b93ae60..1dc8fa499 100644 --- a/src/cas/generic/st/ioBlocked.cc +++ b/src/cas/generic/st/ioBlocked.cc @@ -69,9 +69,7 @@ ioBlockedList::ioBlockedList () // ioBlockedList::~ioBlockedList () { - ioBlocked *pB; - - while ( (pB = this->get ()) ) { + for ( ioBlocked * pB = this->get (); pB; pB = this->get () ) { pB->pList = NULL; } } @@ -86,14 +84,13 @@ ioBlockedList::~ioBlockedList () void ioBlockedList::signal () { tsDLList tmp; - ioBlocked *pB; // // move all of the items onto tmp // tmp.add(*this); - while ( (pB = tmp.get ()) ) { + for ( ioBlocked * pB = tmp.get (); pB; pB = tmp.get () ) { pB->pList = NULL; pB->ioBlockedSignal (); }