diff --git a/src/gdd/gddAppFuncTable.h b/src/gdd/gddAppFuncTable.h index 2040b81f2..5bdaa11cf 100644 --- a/src/gdd/gddAppFuncTable.h +++ b/src/gdd/gddAppFuncTable.h @@ -27,51 +27,6 @@ * Argonne National Laboratory * * - * History - * $Log$ - * Revision 1.12 2000/09/27 19:45:55 jhill - * fixed ifdef around vis c++ pragma - * - * Revision 1.11 2000/03/08 16:12:08 jhill - * fixed gnu version test - * - * Revision 1.10 1999/04/30 00:11:12 jhill - * removed redundant code - * - * Revision 1.9 1998/05/06 21:40:02 jhill - * updated for g++ 2.8.1 - * - * Revision 1.8 1998/04/14 00:51:33 jhill - * code around ms sizeof() bug V5.0 - * - * Revision 1.7 1998/02/18 22:52:22 jhill - * fixed to run on both vis C++ 5.0 and g++ - * - * Revision 1.6 1998/02/05 22:47:46 jhill - * workaround vis C++ 5.0 bug - * - * Revision 1.5 1997/06/25 06:17:36 jhill - * fixed warnings - * - * Revision 1.4 1996/11/22 20:37:19 jhill - * converted large inline templ funcs - * - * Revision 1.3 1996/09/04 20:58:18 jhill - * changes for MS VISC++ - * - * Revision 1.2 1996/08/13 23:13:35 jhill - * win NT changes - * - * Revision 1.1 1996/07/10 23:44:12 jhill - * moved here from src/cas/generic - * - * Revision 1.2 1996/06/26 21:19:01 jhill - * now matches gdd api revisions - * - * Revision 1.1.1.1 1996/06/20 00:28:15 jhill - * ca server installation - * - * */ #ifndef gddAppFuncTableH @@ -106,85 +61,85 @@ template class gddAppFuncTable { public: - gddAppFuncTable() : pMFuncRead(NULL), appTableNElem(0u) - { - } + gddAppFuncTable() : pMFuncRead(NULL), appTableNElem(0u) + { + } - ~gddAppFuncTable() - { - if (this->pMFuncRead) { - delete [] this->pMFuncRead; - } - } + ~gddAppFuncTable() + { + if (this->pMFuncRead) { + delete [] this->pMFuncRead; + } + } #if defined(__GNUC__) && (__GNUC__<2 || (__GNUC__==2 && __GNUC_MINOR__<=7)) - // - // This is required by gnu g++ 2.7.2, but produces the following warning under - // g++ 2.8.1. Unfortunately, the parenthesis in gddAppFuncTablePMF_t below are - // required by g++ 2.7.2. - // - // warning: ANSI C++ forbids array dimensions with parenthesized type in new - // -# define gddAppFuncTablePMF(VAR) gddAppFuncTableStatus (PV:: * VAR)(gdd &) -# define gddAppFuncTablePMF_t (gddAppFuncTableStatus (PV::*)(gdd &)) + // + // This is required by gnu g++ 2.7.2, but produces the following warning under + // g++ 2.8.1. Unfortunately, the parenthesis in gddAppFuncTablePMF_t below are + // required by g++ 2.7.2. + // + // warning: ANSI C++ forbids array dimensions with parenthesized type in new + // +# define gddAppFuncTablePMF(VAR) gddAppFuncTableStatus (PV:: * VAR)(gdd &) +# define gddAppFuncTablePMF_t (gddAppFuncTableStatus (PV::*)(gdd &)) #else - // - // This version should work on most modern C++ compilers. It is required - // by MS vis c++ and also sun pro c++. This also works under g++ 2.8.1. - // - typedef gddAppFuncTableStatus (PV::*gddAppFuncTablePMF_t)(gdd &); -# define gddAppFuncTablePMF(VAR) gddAppFuncTablePMF_t VAR + // + // This version should work on most modern C++ compilers. It is required + // by MS vis c++ and also sun pro c++. This also works under g++ 2.8.1. + // + typedef gddAppFuncTableStatus (PV::*gddAppFuncTablePMF_t)(gdd &); +# define gddAppFuncTablePMF(VAR) gddAppFuncTablePMF_t VAR #endif - // - // installReadFunc() - // - // The 2nd parameter has type "gddAppFuncTablePMF" which is - // a ptr to member function. The member function should - // be declared as follows: - // - // gddAppFuncTableStatus PV::memberFunction(gdd &value); - // - // - // workaround for bug existing only in microsloth vis c++ 5.0. - // (in this version we are unable to overload installReadFunc()) - // + // + // installReadFunc() + // + // The 2nd parameter has type "gddAppFuncTablePMF" which is + // a ptr to member function. The member function should + // be declared as follows: + // + // gddAppFuncTableStatus PV::memberFunction(gdd &value); + // + // + // workaround for bug existing only in microsloth vis c++ 5.0. + // (in this version we are unable to overload installReadFunc()) + // #if defined(_MSC_VER) && _MSC_VER < 1100 - gddAppFuncTableStatus installReadFuncVISC50 (const unsigned type, - gddAppFuncTablePMF(pMFuncIn)); + gddAppFuncTableStatus installReadFuncVISC50 (const unsigned type, + gddAppFuncTablePMF(pMFuncIn)); #else - gddAppFuncTableStatus installReadFunc (const unsigned type, - gddAppFuncTablePMF(pMFuncIn)); + gddAppFuncTableStatus installReadFunc (const unsigned type, + gddAppFuncTablePMF(pMFuncIn)); #endif - // - // installReadFunc() - // - // The 2nd parameter has type "gddAppFuncTablePMF" which is - // a ptr to member function. The member function should - // be declared as follows: - // - // gddAppFuncTableStatus PV::memberFunction(gdd &value); - // - gddAppFuncTableStatus installReadFunc (const char * pName, - gddAppFuncTablePMF(pMFuncIn)); + // + // installReadFunc() + // + // The 2nd parameter has type "gddAppFuncTablePMF" which is + // a ptr to member function. The member function should + // be declared as follows: + // + // gddAppFuncTableStatus PV::memberFunction(gdd &value); + // + gddAppFuncTableStatus installReadFunc (const char * pName, + gddAppFuncTablePMF(pMFuncIn)); - // - // - // - gddAppFuncTableStatus read(PV &pv, gdd &value); - gddAppFuncTableStatus callReadFunc (PV &pv, gdd &value); + // + // + // + gddAppFuncTableStatus read(PV &pv, gdd &value); + gddAppFuncTableStatus callReadFunc (PV &pv, gdd &value); private: - // - // The total number of application tags to manage should be - // hidden from the application (eventually allow for auto - // expansion of the table) - // - gddAppFuncTablePMF(*pMFuncRead); - unsigned appTableNElem; + // + // The total number of application tags to manage should be + // hidden from the application (eventually allow for auto + // expansion of the table) + // + gddAppFuncTablePMF(*pMFuncRead); + unsigned appTableNElem; - void newTbl(unsigned neMaxType); + void newTbl(unsigned neMaxType); }; // @@ -200,26 +155,26 @@ private: // problems resulting from compiler weaknesses // #if defined(_MSC_VER) && _MSC_VER < 1100 - template - gddAppFuncTableStatus gddAppFuncTable::installReadFuncVISC50( - const unsigned type, gddAppFuncTablePMF(pMFuncIn)) + template + gddAppFuncTableStatus gddAppFuncTable::installReadFuncVISC50( + const unsigned type, gddAppFuncTablePMF(pMFuncIn)) #else - template - gddAppFuncTableStatus gddAppFuncTable::installReadFunc( - const unsigned type, gddAppFuncTablePMF(pMFuncIn)) + template + gddAppFuncTableStatus gddAppFuncTable::installReadFunc( + const unsigned type, gddAppFuncTablePMF(pMFuncIn)) #endif { - // - // Attempt to expand the table if the app type will not fit - // - if (type>=this->appTableNElem) { - this->newTbl(type); - if (type>=this->appTableNElem) { - return S_gddAppFuncTable_noMemory; - } - } - this->pMFuncRead[type]=pMFuncIn; - return S_gddAppFuncTable_Success; + // + // Attempt to expand the table if the app type will not fit + // + if (type>=this->appTableNElem) { + this->newTbl(type); + if (type>=this->appTableNElem) { + return S_gddAppFuncTable_noMemory; + } + } + this->pMFuncRead[type]=pMFuncIn; + return S_gddAppFuncTable_Success; } // @@ -233,26 +188,26 @@ private: // template gddAppFuncTableStatus gddAppFuncTable::installReadFunc( - const char * pName, gddAppFuncTablePMF(pMFuncIn)) + const char * pName, gddAppFuncTablePMF(pMFuncIn)) { - aitUint32 type; - gddStatus rc; + aitUint32 type; + gddStatus rc; - rc = gddApplicationTypeTable:: - app_table.registerApplicationType (pName, type); - if (rc!=0 && rc!=gddErrorAlreadyDefined) { - printf( -"at gdd lib limit => read of PV attribute \"%s\" will fail\n", pName); - return S_gddAppFuncTable_gddLimit; - } -# ifdef DEBUG - printf("installing PV attribute %s = %d\n", pName, type); -# endif - + rc = gddApplicationTypeTable:: + app_table.registerApplicationType (pName, type); + if (rc!=0 && rc!=gddErrorAlreadyDefined) { + printf( +"at gdd lib limit => read of PV attribute \"%s\" will fail\n", pName); + return S_gddAppFuncTable_gddLimit; + } +# ifdef DEBUG + printf("installing PV attribute %s = %d\n", pName, type); +# endif + #if defined(_MSC_VER) && _MSC_VER < 1100 - return this->installReadFuncVISC50(type, pMFuncIn); + return this->installReadFuncVISC50(type, pMFuncIn); #else - return this->installReadFunc(type, pMFuncIn); + return this->installReadFunc(type, pMFuncIn); #endif } @@ -268,46 +223,46 @@ gddAppFuncTableStatus gddAppFuncTable::installReadFunc( template void gddAppFuncTable::newTbl(unsigned newApplTypeMax) { - gddAppFuncTablePMF(*pMNewFuncTbl); - unsigned maxApp; - unsigned i; + gddAppFuncTablePMF(*pMNewFuncTbl); + unsigned maxApp; + unsigned i; - if (this->appTableNElem>newApplTypeMax) { - return; - } - maxApp = newApplTypeMax+(1u<<6u); + if (this->appTableNElem>newApplTypeMax) { + return; + } + maxApp = newApplTypeMax+(1u<<6u); # if defined(_MSC_VER) && _MSC_VER <= 1200 // - // MS Visual C++ 6.0 (_MSC_VER==1200) or lower - // compilers allocate the wrong amount of memory - // (i.e. too little) for member function pointers, - // only explicit calculation via sizeof() works. - // - pMNewFuncTbl = (gddAppFuncTablePMF(*)) - new char[sizeof(gddAppFuncTablePMF_t) * maxApp]; -# else - pMNewFuncTbl = new gddAppFuncTablePMF_t[maxApp]; -# endif - if (pMNewFuncTbl) { - for (i=0u; iappTableNElem) { - pMNewFuncTbl[i] = this->pMFuncRead[i]; - } - else { - // - // some versions of NULL include (void *) cast - // (so I am using vanilla zero here) - // - pMNewFuncTbl[i] = 0; - } - } - if (this->pMFuncRead) { - delete [] this->pMFuncRead; - } - this->pMFuncRead = pMNewFuncTbl; - this->appTableNElem = maxApp; - } + // MS Visual C++ 6.0 (_MSC_VER==1200) or lower + // compilers allocate the wrong amount of memory + // (i.e. too little) for member function pointers, + // only explicit calculation via sizeof() works. + // + pMNewFuncTbl = (gddAppFuncTablePMF(*)) + new char[sizeof(gddAppFuncTablePMF_t) * maxApp]; +# else + pMNewFuncTbl = new gddAppFuncTablePMF_t[maxApp]; +# endif + if (pMNewFuncTbl) { + for (i=0u; iappTableNElem) { + pMNewFuncTbl[i] = this->pMFuncRead[i]; + } + else { + // + // some versions of NULL include (void *) cast + // (so I am using vanilla zero here) + // + pMNewFuncTbl[i] = 0; + } + } + if (this->pMFuncRead) { + delete [] this->pMFuncRead; + } + this->pMFuncRead = pMNewFuncTbl; + this->appTableNElem = maxApp; + } } @@ -317,28 +272,28 @@ void gddAppFuncTable::newTbl(unsigned newApplTypeMax) template gddAppFuncTableStatus gddAppFuncTable::read(PV &pv, gdd &value) { - gddAppFuncTableStatus status; + gddAppFuncTableStatus status; - // - // if this gdd is a container then step through it - // and fetch all of the values inside - // - if (value.isContainer()) { - gddContainer *pCont = (gddContainer *) &value; - gddCursor curs = pCont->getCursor(); - gdd *pItem; + // + // if this gdd is a container then step through it + // and fetch all of the values inside + // + if (value.isContainer()) { + gddContainer *pCont = (gddContainer *) &value; + gddCursor curs = pCont->getCursor(); + gdd *pItem; - status = S_gddAppFuncTable_Success; - for (pItem=curs.first(); pItem; pItem=curs.next()) - { - status = this->read(pv, *pItem); - if (status) { - break; - } - } - return status; - } - return callReadFunc(pv, value); + status = S_gddAppFuncTable_Success; + for (pItem=curs.first(); pItem; pItem=curs.next()) + { + status = this->read(pv, *pItem); + if (status) { + break; + } + } + return status; + } + return callReadFunc(pv, value); } // @@ -347,28 +302,28 @@ gddAppFuncTableStatus gddAppFuncTable::read(PV &pv, gdd &value) template gddAppFuncTableStatus gddAppFuncTable::callReadFunc (PV &pv, gdd &value) { - unsigned type; - gddAppFuncTablePMF(pFunc); + unsigned type; + gddAppFuncTablePMF(pFunc); - // - // otherwise call the function associated - // with this application type - // - type = value.applicationType(); - if (type>=this->appTableNElem) { - errPrintf (S_gddAppFuncTable_badType, __FILE__, - __LINE__, "- large appl type code = %u\n", - type); - return S_gddAppFuncTable_badType; - } - pFunc = this->pMFuncRead[type]; - if (pFunc==NULL) { - errPrintf (S_gddAppFuncTable_badType, __FILE__, - __LINE__, "- ukn appl type code = %u\n", - type); - return S_gddAppFuncTable_badType; - } - return (pv.*pFunc)(value); + // + // otherwise call the function associated + // with this application type + // + type = value.applicationType(); + if (type>=this->appTableNElem) { + errPrintf (S_gddAppFuncTable_badType, __FILE__, + __LINE__, "- large appl type code = %u\n", + type); + return S_gddAppFuncTable_badType; + } + pFunc = this->pMFuncRead[type]; + if (pFunc==NULL) { + errPrintf (S_gddAppFuncTable_badType, __FILE__, + __LINE__, "- ukn appl type code = %u\n", + type); + return S_gddAppFuncTable_badType; + } + return (pv.*pFunc)(value); } diff --git a/src/libCom/fdmgr/fdManager.cpp b/src/libCom/fdmgr/fdManager.cpp index 5c98197d7..031c938b8 100644 --- a/src/libCom/fdmgr/fdManager.cpp +++ b/src/libCom/fdmgr/fdManager.cpp @@ -66,9 +66,9 @@ // This explicitly instantiates the template class's member // functions used by fdManager // - // instantiated by "fdManager fileDescriptorManager;" statement below? - // (according to ms vis C++) - // + // instantiated by "fdManager fileDescriptorManager;" statement below? + // (according to ms vis C++) + // template class resTable ; #endif @@ -92,21 +92,21 @@ inline const unsigned fdRegId::maxIndexBitWidth () // fdManager::fdManager() // epicsShareFunc fdManager::fdManager (osiTimerQueue &timerQueueIn) : - fdTbl (1<fdSets) / sizeof ( this->fdSets[0u] ); i++ ) { - FD_ZERO ( &this->fdSets[i] ); - } - this->maxFD = 0; - this->processInProg = 0u; - this->pCBReg = 0; + for ( i=0u; i < sizeof (this->fdSets) / sizeof ( this->fdSets[0u] ); i++ ) { + FD_ZERO ( &this->fdSets[i] ); + } + this->maxFD = 0; + this->processInProg = 0u; + this->pCBReg = 0; } // @@ -114,17 +114,17 @@ epicsShareFunc fdManager::fdManager (osiTimerQueue &timerQueueIn) : // epicsShareFunc fdManager::~fdManager() { - fdReg *pReg; + fdReg *pReg; - while ( (pReg = this->regList.get()) ) { - pReg->state = fdReg::limbo; - pReg->destroy(); - } - while ( (pReg = this->activeList.get()) ) { - pReg->state = fdReg::limbo; - pReg->destroy(); - } - osiSockRelease(); + while ( (pReg = this->regList.get()) ) { + pReg->state = fdReg::limbo; + pReg->destroy(); + } + while ( (pReg = this->activeList.get()) ) { + pReg->state = fdReg::limbo; + pReg->destroy(); + } + osiSockRelease(); } // @@ -132,135 +132,135 @@ epicsShareFunc fdManager::~fdManager() // epicsShareFunc void fdManager::process (double delay) { - double minDelay; - fdReg *pReg; - struct timeval tv; - int status; - int ioPending = 0; + double minDelay; + fdReg *pReg; + struct timeval tv; + int status; + int ioPending = 0; - // - // no recursion - // - if (this->processInProg) { - return; - } - this->processInProg = 1; + // + // no recursion + // + if (this->processInProg) { + return; + } + this->processInProg = 1; - // - // One shot at expired timers prior to going into - // select. This allows zero delay timers to arm - // fd writes. We will never process the timer queue - // more than once here so that fd activity get serviced - // in a reasonable length of time. - // - minDelay = this->timerQueue.delayToFirstExpire(); - if (minDelay<=0.0) { - this->timerQueue.process(); - minDelay = this->timerQueue.delayToFirstExpire(); - } + // + // One shot at expired timers prior to going into + // select. This allows zero delay timers to arm + // fd writes. We will never process the timer queue + // more than once here so that fd activity get serviced + // in a reasonable length of time. + // + minDelay = this->timerQueue.delayToFirstExpire(); + if (minDelay<=0.0) { + this->timerQueue.process(); + minDelay = this->timerQueue.delayToFirstExpire(); + } - if (minDelay>=delay) { - minDelay = delay; - } + if (minDelay>=delay) { + minDelay = delay; + } tsDLIterBD iter (this->regList.first()); - while ( iter.valid () ) { - FD_SET(iter->getFD(), &this->fdSets[iter->getType()]); - ioPending = 1; + while ( iter.valid () ) { + FD_SET(iter->getFD(), &this->fdSets[iter->getType()]); + ioPending = 1; ++iter; - } + } - tv.tv_sec = static_cast (minDelay); - tv.tv_usec = static_cast ((minDelay-tv.tv_sec)*osiTime::uSecPerSec); + tv.tv_sec = static_cast (minDelay); + tv.tv_usec = static_cast ((minDelay-tv.tv_sec)*osiTime::uSecPerSec); - /* - * win32 requires this (others will - * run faster with this installed) - */ - if (!ioPending) { - /* - * recover from subtle differences between - * windows sockets and UNIX sockets implementation - * of select() - */ - if (minDelay>0.0) threadSleep(minDelay); - status = 0; - } - else { - status = select (this->maxFD, &this->fdSets[fdrRead], - &this->fdSets[fdrWrite], &this->fdSets[fdrException], &tv); - } + /* + * win32 requires this (others will + * run faster with this installed) + */ + if (!ioPending) { + /* + * recover from subtle differences between + * windows sockets and UNIX sockets implementation + * of select() + */ + if (minDelay>0.0) threadSleep(minDelay); + status = 0; + } + else { + status = select (this->maxFD, &this->fdSets[fdrRead], + &this->fdSets[fdrWrite], &this->fdSets[fdrException], &tv); + } - this->timerQueue.process(); - if (status==0) { - this->processInProg = 0; - return; - } - else if (status<0) { + this->timerQueue.process(); + if (status==0) { + this->processInProg = 0; + return; + } + else if (status<0) { int errnoCpy = SOCKERRNO; // // print a message if its an unexpected error // - if (errnoCpy != SOCK_EINTR) { - fprintf(stderr, - "fdManager: select failed because \"%s\"\n", - SOCKERRSTR(errnoCpy)); - } + if (errnoCpy != SOCK_EINTR) { + fprintf(stderr, + "fdManager: select failed because \"%s\"\n", + SOCKERRSTR(errnoCpy)); + } - this->processInProg = 0; + this->processInProg = 0; - return; + return; } - // - // Look for activity - // - iter=this->regList.first(); - while ( iter.valid () ) { + // + // Look for activity + // + iter=this->regList.first(); + while ( iter.valid () ) { tsDLIterBD tmp = iter; - tmp++; - if (FD_ISSET(iter->getFD(), &this->fdSets[iter->getType()])) { - FD_CLR(iter->getFD(), &this->fdSets[iter->getType()]); - this->regList.remove(*iter); - this->activeList.add(*iter); - iter->state = fdReg::active; - } - iter=tmp; - } + tmp++; + if (FD_ISSET(iter->getFD(), &this->fdSets[iter->getType()])) { + FD_CLR(iter->getFD(), &this->fdSets[iter->getType()]); + this->regList.remove(*iter); + this->activeList.add(*iter); + iter->state = fdReg::active; + } + iter=tmp; + } - // - // I am careful to prevent problems if they access the - // above list while in a "callBack()" routine - // - while ( (pReg = this->activeList.get()) ) { - pReg->state = fdReg::limbo; + // + // I am careful to prevent problems if they access the + // above list while in a "callBack()" routine + // + while ( (pReg = this->activeList.get()) ) { + pReg->state = fdReg::limbo; - // - // Tag current fdReg so that we - // can detect if it was deleted - // during the call back - // - this->pCBReg = pReg; - pReg->callBack(); - if (this->pCBReg != NULL) { - // - // check only after we see that it is non-null so - // that we dont trigger bounds-checker dangling pointer - // error - // - assert (this->pCBReg==pReg); - this->pCBReg = 0; - if (pReg->onceOnly) { - pReg->destroy(); - } - else { - this->regList.add(*pReg); - pReg->state = fdReg::pending; - } - } - } - this->processInProg = 0; + // + // Tag current fdReg so that we + // can detect if it was deleted + // during the call back + // + this->pCBReg = pReg; + pReg->callBack(); + if (this->pCBReg != NULL) { + // + // check only after we see that it is non-null so + // that we dont trigger bounds-checker dangling pointer + // error + // + assert (this->pCBReg==pReg); + this->pCBReg = 0; + if (pReg->onceOnly) { + pReg->destroy(); + } + else { + this->regList.add(*pReg); + pReg->state = fdReg::pending; + } + } + } + this->processInProg = 0; } // @@ -269,7 +269,7 @@ epicsShareFunc void fdManager::process (double delay) // epicsShareFunc void fdReg::destroy() { - delete this; + delete this; } // @@ -277,7 +277,7 @@ epicsShareFunc void fdReg::destroy() // epicsShareFunc fdReg::~fdReg() { - this->manager.removeReg(*this); + this->manager.removeReg(*this); } // @@ -285,12 +285,12 @@ epicsShareFunc fdReg::~fdReg() // epicsShareFunc void fdReg::show(unsigned level) const { - printf ("fdReg at %p\n", (void *) this); - if (level>1u) { - printf ("\tstate = %d, onceOnly = %d\n", - this->state, this->onceOnly); - } - this->fdRegId::show(level); + printf ("fdReg at %p\n", (void *) this); + if (level>1u) { + printf ("\tstate = %d, onceOnly = %d\n", + this->state, this->onceOnly); + } + this->fdRegId::show(level); } // @@ -298,11 +298,11 @@ epicsShareFunc void fdReg::show(unsigned level) const // void fdRegId::show(unsigned level) const { - printf ("fdRegId at %p\n", this); - if (level>1u) { - printf ("\tfd = %d, type = %d\n", - this->fd, this->type); - } + printf ("fdRegId at %p\n", this); + if (level>1u) { + printf ("\tfd = %d, type = %d\n", + this->fd, this->type); + } } // @@ -311,11 +311,11 @@ void fdRegId::show(unsigned level) const epicsShareFunc void fdManager::installReg (fdReg ®) { this->maxFD = tsMax(this->maxFD, reg.getFD()+1); - this->regList.add (reg); - reg.state = fdReg::pending; + this->regList.add (reg); + reg.state = fdReg::pending; int status = this->fdTbl.add (reg); - if (status!=0) { + if (status!=0) { throwWithLocation ( fdInterestSubscriptionAlreadyExits () ); } } @@ -325,41 +325,41 @@ epicsShareFunc void fdManager::installReg (fdReg ®) // void fdManager::removeReg (fdReg ®In) { - fdReg *pItemFound; + fdReg *pItemFound; - pItemFound = this->fdTbl.remove (regIn); - if (pItemFound!=®In) { - fprintf(stderr, - "fdManager::removeReg() bad fd registration object\n"); - return; - } + pItemFound = this->fdTbl.remove (regIn); + if (pItemFound!=®In) { + fprintf(stderr, + "fdManager::removeReg() bad fd registration object\n"); + return; + } - // - // signal fdManager that the fdReg was deleted - // during the call back - // - if (this->pCBReg == ®In) { - this->pCBReg = 0; - } - - switch (regIn.state) { - case fdReg::active: + // + // signal fdManager that the fdReg was deleted + // during the call back + // + if (this->pCBReg == ®In) { + this->pCBReg = 0; + } + + switch (regIn.state) { + case fdReg::active: this->activeList.remove (regIn); - break; - case fdReg::pending: + break; + case fdReg::pending: this->regList.remove (regIn); - break; - case fdReg::limbo: - break; - default: - // - // here if memory corrupted - // - assert(0); - } - regIn.state = fdReg::limbo; + break; + case fdReg::limbo: + break; + default: + // + // here if memory corrupted + // + assert(0); + } + regIn.state = fdReg::limbo; - FD_CLR(regIn.getFD(), &this->fdSets[regIn.getType()]); + FD_CLR(regIn.getFD(), &this->fdSets[regIn.getType()]); } // @@ -367,26 +367,26 @@ void fdManager::removeReg (fdReg ®In) // epicsShareFunc fdReg *fdManager::lookUpFD (const SOCKET fd, const fdRegType type) { - if (fd<0) { - return NULL; - } - fdRegId id (fd,type); - return this->fdTbl.lookup(id); + if (fd<0) { + return NULL; + } + fdRegId id (fd,type); + return this->fdTbl.lookup(id); } // // fdReg::fdReg() // fdReg::fdReg (const SOCKET fdIn, const fdRegType typIn, - const bool onceOnlyIn, fdManager &managerIn) : - fdRegId (fdIn,typIn), state (limbo), - onceOnly (onceOnlyIn), manager (managerIn) + const bool onceOnlyIn, fdManager &managerIn) : + fdRegId (fdIn,typIn), state (limbo), + onceOnly (onceOnlyIn), manager (managerIn) { - if (!FD_IN_FDSET(fdIn)) { - fprintf (stderr, "%s: fd > FD_SETSIZE ignored\n", - __FILE__); - return; - } - this->manager.installReg (*this); + if (!FD_IN_FDSET(fdIn)) { + fprintf (stderr, "%s: fd > FD_SETSIZE ignored\n", + __FILE__); + return; + } + this->manager.installReg (*this); }