82 this->lazyInitTimerQueue ();
87 if (this->processInProg) {
90 this->processInProg =
true;
99 double minDelay = this->pTimerQueue->process(epicsTime::getCurrent());
101 if ( minDelay >= delay ) {
105 bool ioPending =
false;
107 while ( iter.
valid () ) {
108 FD_SET(iter->
getFD(), &this->fdSetsPtr[iter->
getType()]);
115 tv.tv_sec =
static_cast<time_t
> ( minDelay );
116 tv.tv_usec =
static_cast<long> ( (minDelay-tv.tv_sec) *
uSecPerSec );
118 fd_set * pReadSet = & this->fdSetsPtr[
fdrRead];
119 fd_set * pWriteSet = & this->fdSetsPtr[
fdrWrite];
121 int status =
select (this->maxFD, pReadSet, pWriteSet, pExceptSet, &tv);
123 this->pTimerQueue->process(epicsTime::getCurrent());
131 while ( iter.
valid () && status > 0 ) {
134 if (FD_ISSET(iter->
getFD(), &this->fdSetsPtr[iter->
getType()])) {
135 FD_CLR(iter->
getFD(), &this->fdSetsPtr[iter->
getType()]);
136 this->regList.
remove(*iter);
137 this->activeList.
add(*iter);
138 iter->state = fdReg::active;
149 while ( (pReg = this->activeList.
get()) ) {
150 pReg->state = fdReg::limbo;
159 if (this->pCBReg !=
NULL) {
165 assert (this->pCBReg==pReg);
167 if (pReg->onceOnly) {
171 this->regList.
add(*pReg);
172 pReg->state = fdReg::pending;
177 else if ( status < 0 ) {
183 FD_ZERO ( &fdSetsPtr[
i] );
192 sockErrBuf,
sizeof ( sockErrBuf ) );
194 "fdManager: select failed because \"%s\"\n",
206 this->pTimerQueue->process(epicsTime::getCurrent());
208 this->processInProg =
false;
#define assert(exp)
Declare that a condition should be true.
fdRegType getType() const
tsDLIterConst< T > firstIter() const
const unsigned uSecPerSec
void epicsSocketConvertErrnoToString(char *pBuf, unsigned bufSize)
BSD and SRV5 Unix timestamp.
int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
LIBCOM_API void epicsStdCall epicsThreadSleep(double seconds)
Block the calling thread for at least the specified time.