19 #ifndef fdManagerH_included
20 #define fdManagerH_included
22 #include "libComAPI.h"
24 #include "resourceLib.h"
27 #include "epicsTimer.h"
29 enum fdRegType {fdrRead, fdrWrite, fdrException, fdrNEnums};
40 fdRegId (
const SOCKET fdIn,
const fdRegType typeIn) :
41 fd(fdIn), type(typeIn) {}
48 fdRegType getType ()
const
53 bool operator == (
const fdRegId &idIn)
const
55 return this->fd == idIn.fd && this->type==idIn.type;
58 resTableIndex hash ()
const;
60 virtual void show (
unsigned level)
const;
82 LIBCOM_API
void process (
double delay );
85 LIBCOM_API
class fdReg *lookUpFD (
const SOCKET fd,
const fdRegType type);
93 const double sleepQuantum;
105 void installReg (
fdReg ®);
106 void removeReg (
fdReg ®);
107 void lazyInitTimerQueue ();
116 LIBCOM_API
extern fdManager fileDescriptorManager;
129 fdReg (
const SOCKET fdIn,
const fdRegType type,
130 const bool onceOnly=
false,
fdManager &manager = fileDescriptorManager);
133 virtual void show (
unsigned level)
const;
144 virtual void destroy ();
147 enum state {active, pending, limbo};
156 virtual void callBack ()=0;
159 unsigned char onceOnly;
169 inline resTableIndex fdRegId::hash ()
const
171 const unsigned fdManagerHashTableMinIndexBits = 8;
172 const unsigned fdManagerHashTableMaxIndexBits =
sizeof(SOCKET)*CHAR_BIT;
173 resTableIndex hashid;
175 hashid = integerHash ( fdManagerHashTableMinIndexBits,
176 fdManagerHashTableMaxIndexBits, this->fd );
181 hashid ^= this->type;
190 inline void fdManager::lazyInitTimerQueue ()
192 if ( ! this->pTimerQueue ) {
193 this->pTimerQueue = & epicsTimerQueuePassive::create ( *
this );
199 this->lazyInitTimerQueue ();
200 return this->pTimerQueue->createTimer ();
203 #endif // fdManagerH_included
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...