fix for mantis 159

This commit is contained in:
Jeff Hill
2004-11-24 22:11:20 +00:00
parent 26c756d4cf
commit fb931434bd
2 changed files with 19 additions and 20 deletions

View File

@@ -115,8 +115,8 @@ inline casStreamWriteReg::~casStreamWriteReg ()
//
// casStreamEvWakeup()
//
casStreamEvWakeup::casStreamEvWakeup () :
timer ( fileDescriptorManager.createTimer() ), pOS ( 0 )
casStreamEvWakeup::casStreamEvWakeup ( casStreamOS & osIn ) :
timer ( fileDescriptorManager.createTimer() ), os ( osIn )
{
}
@@ -144,12 +144,9 @@ void casStreamEvWakeup::show(unsigned level) const
//
epicsTimerNotify::expireStatus casStreamEvWakeup::expire ( const epicsTime & /* currentTime */ )
{
casStreamOS & os = *this->pOS;
this->pOS = 0;
casEventSys::processStatus ps = os.eventSysProcess ();
if ( ps.nAccepted > 0u ) {
os.eventFlush ();
this->os.eventFlush ();
}
if ( ps.cond != casProcOk ) {
//
@@ -160,7 +157,7 @@ epicsTimerNotify::expireStatus casStreamEvWakeup::expire ( const epicsTime & /*
// called from a client member function
// higher up on the stack
//
delete & os;
delete & this->os;
//
// must not touch the "this" pointer
@@ -175,13 +172,13 @@ epicsTimerNotify::expireStatus casStreamEvWakeup::expire ( const epicsTime & /*
//
void casStreamEvWakeup::start( casStreamOS &os )
{
if ( this->pOS ) {
assert ( this->pOS == &os );
}
else {
this->pOS = &os;
this->timer.start ( *this, 0.0 );
}
// care is needed here because this is called
// asynchronously by postEvent
//
// there is some overhead here but care is taken
// in the caller of this routine to call this
// only when its the 2nd event on the queue
this->timer.start ( *this, 0.0 );
}
//
@@ -317,10 +314,12 @@ void casStreamOS::eventFlush()
//
// casStreamOS::casStreamOS()
//
casStreamOS::casStreamOS ( caServerI & cas, clientBufMemoryManager & bufMgrIn,
const ioArgsToNewStreamIO & ioArgs ) :
casStreamIO ( cas, bufMgrIn, ioArgs ),
pWtReg ( 0 ), pRdReg ( 0 ), sendBlocked ( false )
casStreamOS::casStreamOS (
caServerI & cas, clientBufMemoryManager & bufMgrIn,
const ioArgsToNewStreamIO & ioArgs ) :
casStreamIO ( cas, bufMgrIn, ioArgs ),
evWk ( *this ), pWtReg ( 0 ), pRdReg ( 0 ),
sendBlocked ( false )
{
this->xSetNonBlocking ();
this->armRecv ();

View File

@@ -48,13 +48,13 @@ private:
class casStreamEvWakeup : public epicsTimerNotify {
public:
casStreamEvWakeup ();
casStreamEvWakeup ( casStreamOS & );
virtual ~casStreamEvWakeup ();
void show ( unsigned level ) const;
void start ( class casStreamOS & osIn );
private:
epicsTimer & timer;
casStreamOS * pOS;
casStreamOS & os;
expireStatus expire ( const epicsTime & currentTime );
casStreamEvWakeup ( const casStreamEvWakeup & );
casStreamEvWakeup & operator = ( const casStreamEvWakeup & );