This commit is contained in:
Jeff Hill
2001-03-07 16:14:57 +00:00
parent ffbe181b58
commit 0f9e890314
2 changed files with 0 additions and 163 deletions

View File

@@ -1,86 +0,0 @@
/*
* $Id$
*
*
* L O S A L A M O S
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
*
* Copyright, 1986, The Regents of the University of California.
*
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#include "iocinf.h"
void ioCounter::decrementOutstandingIO ()
{
bool signalNeeded;
this->mutex.lock ();
if ( this->pndrecvcnt > 0u ) {
this->pndrecvcnt--;
if ( this->pndrecvcnt == 0u ) {
signalNeeded = true;
}
else {
signalNeeded = false;
}
}
else {
signalNeeded = true;
}
this->mutex.unlock ();
if ( signalNeeded ) {
this->ioDone.signal ();
}
}
void ioCounter::decrementOutstandingIO ( unsigned seqNumber )
{
bool signalNeeded;
this->mutex.lock ();
if ( this->readSeq == seqNumber ) {
if ( this->pndrecvcnt > 0u ) {
this->pndrecvcnt--;
if ( this->pndrecvcnt == 0u ) {
signalNeeded = true;
}
else {
signalNeeded = false;
}
}
else {
signalNeeded = true;
}
}
else {
signalNeeded = false;
}
this->mutex.unlock ();
if ( signalNeeded ) {
this->ioDone.signal ();
}
}
void ioCounter::showOutstandingIO ( unsigned level ) const
{
printf ( "ioCounter at %p\n",
static_cast <const void *> ( this ) );
printf ( "\tthere are %u unsatisfied IO operations blocking ca_pend_io()\n",
this->pndrecvcnt );
if ( level > 0u ) {
printf ( "\tthe current read sequence number is %u\n",
this->readSeq );
}
if ( level > 1u ) {
printf ( "IO done event:\n");
this->ioDone.show ( level - 2u );
}
}

View File

@@ -1,77 +0,0 @@
/*
* $Id$
*
*
* L O S A L A M O S
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
*
* Copyright, 1986, The Regents of the University of California.
*
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef ioCounter_ILh
#define ioCounter_ILh
inline ioCounter::ioCounter () : pndrecvcnt ( 0u ), readSeq ( 0u )
{
}
inline void ioCounter::incrementOutstandingIO ()
{
this->mutex.lock ();
if ( this->pndrecvcnt < UINT_MAX ) {
this->pndrecvcnt++;
}
else {
throwWithLocation ( caErrorCode (ECA_INTERNAL) );
}
this->mutex.unlock ();
}
inline void ioCounter::incrementOutstandingIO ( unsigned readSeqIn )
{
this->mutex.lock ();
if ( readSeqIn == this->readSeq ) {
if ( this->pndrecvcnt < UINT_MAX ) {
this->pndrecvcnt++;
}
else {
throwWithLocation ( caErrorCode (ECA_INTERNAL) );
}
}
this->mutex.unlock ();
}
inline unsigned ioCounter::readSequenceOfOutstandingIO () const
{
return this->readSeq;
}
inline unsigned ioCounter::currentOutstandingIOCount () const
{
return this->pndrecvcnt;
}
inline void ioCounter::waitForCompletionOfIO ( double delaySec )
{
this->ioDone.wait ( delaySec );
}
inline void ioCounter::cleanUpOutstandingIO ()
{
this->mutex.lock ();
this->readSeq++;
this->pndrecvcnt = 0u;
this->mutex.unlock ();
}
#endif // ioCounter_ILh