|
xrootd
|
#include <XrdSysIOEvents.hh>


Classes | |
| struct | PipeData |
Public Member Functions | |
| void | Stop () |
| Poller (int cFD, int rFD) | |
| virtual | ~Poller () |
| Destructor. Stop() is effecively called when this object is deleted. | |
Static Public Member Functions | |
| static Poller * | Create (int &eNum, const char **eTxt=0) |
Protected Member Functions | |
| void | CbkTMO () |
| bool | CbkXeq (Channel *cP, int events, int eNum, const char *eTxt) |
| int | GetFault (Channel *cP) |
| int | GetPollEnt (Channel *cP) |
| int | GetRequest () |
| bool | Init (Channel *cP, int &eNum, const char **eTxt, bool &isLockd) |
| void | LockChannel (Channel *cP) |
| int | Poll2Enum (short events) |
| int | SendCmd (PipeData &cmd) |
| void | SetPollEnt (Channel *cP, int ptEnt) |
| bool | TmoAdd (Channel *cP) |
| void | TmoDel (Channel *cP) |
| int | TmoGet () |
| void | UnLockChannel (Channel *cP) |
| virtual void | Begin (XrdSysSemaphore *syncp, int &rc, const char **eTxt)=0 |
| virtual void | Exclude (Channel *cP, bool &isLocked, bool dover=1)=0 |
| virtual bool | Include (Channel *cP, int &eNum, const char **eTxt, bool &isLocked)=0 |
| virtual bool | Modify (Channel *cP, int &eNum, const char **eTxt, bool &isLocked)=0 |
| virtual void | Shutdown ()=0 |
Protected Attributes | |
| Channel * | attBase |
| Channel * | tmoBase |
| pthread_t | pollTid |
| struct pollfd | pipePoll |
| int | cmdFD |
| int | reqFD |
| PipeData | reqBuff |
| char * | pipeBuff |
| int | pipeBlen |
| bool | wakePend |
| bool | chDead |
Static Protected Attributes | |
| static time_t | maxTime = (sizeof(time_t) == 8 ? 0x7fffffffffffffffLL : 0x7fffffff) |
Private Member Functions | |
| void | Attach (Channel *cP) |
| void | Detach (Channel *cP, bool &isLocked, bool keep=true) |
| void | WakeUp () |
Static Private Member Functions | |
| static Poller * | newPoller (int pFD[2], int &eNum, const char **eTxt) |
Private Attributes | |
| XrdSysMutex | adMutex |
| XrdSysRecMutex | toMutex |
Friends | |
| class | BootStrap |
| class | Channel |
Define a poller object interface. A poller fields and dispatches event callbacks. An actual instance of a poller object is obtained by using the Create() method. You cannot simply create an instance of this object using new or in-place declaration since it is abstract. Any number of these objects may created. Each creation spawns a polling thread.
| XrdSys::IOEvents::Poller::Poller | ( | int | cFD, |
| int | rFD | ||
| ) |
Constructor
| cFD | The file descriptor to send commands to the poll thread. |
| rFD | The file descriptor to recv commands in the poll thread. |
| virtual XrdSys::IOEvents::Poller::~Poller | ( | ) | [inline, virtual] |
Destructor. Stop() is effecively called when this object is deleted.
| void XrdSys::IOEvents::Poller::Attach | ( | Channel * | cP | ) | [private] |
References INSERT.
Referenced by XrdSys::IOEvents::Channel::Channel().
| virtual void XrdSys::IOEvents::Poller::Begin | ( | XrdSysSemaphore * | syncp, |
| int & | rc, | ||
| const char ** | eTxt | ||
| ) | [protected, pure virtual] |
Start the polling event loop. An implementation must be supplied. Begin() is called via the internal BootStrap class from a new thread.
Implemented in XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerErr1, XrdSys::IOEvents::PollPort, XrdSys::IOEvents::PollE, and XrdSys::IOEvents::PollPoll.
Referenced by XrdSys::IOEvents::BootStrap::Start().
| void XrdSys::IOEvents::Poller::CbkTMO | ( | ) | [protected] |
References XrdSys::IOEvents::Channel::deadLine, and XrdSys::IOEvents::Channel::dlType.
| bool XrdSys::IOEvents::Poller::CbkXeq | ( | Channel * | cP, |
| int | events, | ||
| int | eNum, | ||
| const char * | eTxt | ||
| ) | [protected] |
References XrdSys::IOEvents::Channel::chCB, XrdSys::IOEvents::Channel::chCBA, XrdSys::IOEvents::Channel::chEvents, XrdSys::IOEvents::Channel::chFault, XrdSys::IOEvents::Channel::chMutex, XrdSys::IOEvents::Channel::chPoller, XrdSys::IOEvents::Channel::chPollXQ, XrdSys::IOEvents::Channel::chRTO, XrdSys::IOEvents::Channel::chStat, XrdSys::IOEvents::Channel::chWTO, XrdSys::IOEvents::Channel::errorEvents, XrdSys::IOEvents::CallBack::Event(), XrdSys::IOEvents::CallBack::Fatal(), XrdSys::IOEvents::Channel::inPSet, XrdSys::IOEvents::Channel::inTOQ, XrdSys::IOEvents::Channel::isCBMode, XrdSys::IOEvents::Channel::isClear, XrdSys::IOEvents::Channel::isDead, XrdSysMutex::Lock(), XrdSysMutexHelper::Lock(), XrdSys::IOEvents::pollErr1, XrdSys::IOEvents::Channel::rdDL, XrdSys::IOEvents::CallBack::ReadTimeOut, XrdSys::IOEvents::CallBack::ReadyToRead, XrdSys::IOEvents::CallBack::ReadyToWrite, REVENTS, XrdSysMutexHelper::UnLock(), WEVENTS, XrdSys::IOEvents::Channel::wrDL, and XrdSys::IOEvents::CallBack::WriteTimeOut.
| XrdSys::IOEvents::Poller * XrdSys::IOEvents::Poller::Create | ( | int & | eNum, |
| const char ** | eTxt = 0 |
||
| ) | [static] |
Create a specialized instance of a poller object, initialize it, and start the polling process. You must call Create() to obtain a specialized poller.
| eNum | Place where errno is placed upon failure. |
| eTxt | Place where a pointer to the description of the failing operation is to be set. If null, no description is returned. |
References close(), fcntl(), XrdSys::IOEvents::pollArg::pollP, XrdSysThread::Run(), XrdSys::IOEvents::BootStrap::Start(), and XRDSYSTHREAD_BIND.
| void XrdSys::IOEvents::Poller::Detach | ( | Channel * | cP, |
| bool & | isLocked, | ||
| bool | keep = true |
||
| ) | [private] |
References XrdSys::IOEvents::Channel::attList, XrdSys::IOEvents::Channel::chCB, XrdSys::IOEvents::Channel::chCBA, XrdSys::IOEvents::Channel::chFD, XrdSys::IOEvents::Channel::chPollXQ, XrdSys::IOEvents::Channel::inPSet, XrdSys::IOEvents::Channel::inTOQ, ISPOLLER, XrdSys::IOEvents::Channel::dlQ::next, XrdSys::IOEvents::pollErr1, REMOVE, and XrdSys::IOEvents::Channel::Reset().
Referenced by XrdSys::IOEvents::Channel::~Channel().
| virtual void XrdSys::IOEvents::Poller::Exclude | ( | Channel * | cP, |
| bool & | isLocked, | ||
| bool | dover = 1 |
||
| ) | [protected, pure virtual] |
Remove a channel to the poll set. An implementation must be supplied. The channel is locked when this method is called but must be unlocked by the method if a command is sent to the poller thread and isLocked set to false.
Implemented in XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerErr1, XrdSys::IOEvents::PollPort, XrdSys::IOEvents::PollE, and XrdSys::IOEvents::PollPoll.
| int XrdSys::IOEvents::Poller::GetFault | ( | Channel * | cP | ) | [inline, protected] |
References XrdSys::IOEvents::Channel::chFault.
Referenced by XrdSys::IOEvents::PollerErr1::Include(), and XrdSys::IOEvents::PollerErr1::Modify().
| int XrdSys::IOEvents::Poller::GetPollEnt | ( | Channel * | cP | ) | [inline, protected] |
References XrdSys::IOEvents::Channel::pollEnt.
| int XrdSys::IOEvents::Poller::GetRequest | ( | ) | [protected] |
References read().
| virtual bool XrdSys::IOEvents::Poller::Include | ( | Channel * | cP, |
| int & | eNum, | ||
| const char ** | eTxt, | ||
| bool & | isLocked | ||
| ) | [protected, pure virtual] |
Add a channel to the poll set. An implementation must be supplied. The channel is locked when this method is called but must be unlocked by the method if a command is sent to the poller thread and isLocked set to false.
Implemented in XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerErr1, XrdSys::IOEvents::PollPort, XrdSys::IOEvents::PollE, and XrdSys::IOEvents::PollPoll.
Referenced by Init().
| bool XrdSys::IOEvents::Poller::Init | ( | Channel * | cP, |
| int & | eNum, | ||
| const char ** | eTxt, | ||
| bool & | isLockd | ||
| ) | [protected] |
References XrdSys::IOEvents::Channel::chCB, XrdSys::IOEvents::Channel::chEvents, XrdSys::IOEvents::Channel::chFault, XrdSys::IOEvents::Channel::chMutex, XrdSys::IOEvents::Channel::chPoller, XrdSys::IOEvents::Channel::chPollXQ, Include(), XrdSys::IOEvents::Channel::inPSet, XrdSysMutex::Lock(), Modify(), XrdSys::IOEvents::pollErr1, XrdSys::IOEvents::pollWait, and XrdSys::IOEvents::Channel::reMod.
Referenced by XrdSys::IOEvents::PollerInit::Modify().
| void XrdSys::IOEvents::Poller::LockChannel | ( | Channel * | cP | ) | [inline, protected] |
References XrdSys::IOEvents::Channel::chMutex, and XrdSysMutex::Lock().
| virtual bool XrdSys::IOEvents::Poller::Modify | ( | Channel * | cP, |
| int & | eNum, | ||
| const char ** | eTxt, | ||
| bool & | isLocked | ||
| ) | [protected, pure virtual] |
Modify the event status of a channel. An implementation must be supplied. The channel is locked when this method is called but must be unlocked by the method if a command is sent to the poller thread and isLocked set to false.
Implemented in XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerErr1, XrdSys::IOEvents::PollPort, XrdSys::IOEvents::PollE, and XrdSys::IOEvents::PollPoll.
Referenced by Init().
| XrdSys::IOEvents::Poller * XrdSys::IOEvents::Poller::newPoller | ( | int | pFD[2], |
| int & | eNum, | ||
| const char ** | eTxt | ||
| ) | [static, private] |
References XrdSys::IOEvents::PollE::AllocMem(), close(), and fcntl().
| int XrdSys::IOEvents::Poller::Poll2Enum | ( | short | events | ) | [protected] |
| int XrdSys::IOEvents::Poller::SendCmd | ( | PipeData & | cmd | ) | [protected] |
| void XrdSys::IOEvents::Poller::SetPollEnt | ( | Channel * | cP, |
| int | ptEnt | ||
| ) | [protected] |
References XrdSys::IOEvents::Channel::pollEnt.
| virtual void XrdSys::IOEvents::Poller::Shutdown | ( | ) | [protected, pure virtual] |
Shutdown the poller. An implementation must be supplied. The shutdown method must release any allocated storage and close private file descriptors. The polling thread will have already been terminated and x-thread pipe closed. Warning: the derived destructor *must* call Stop() and do nothing else!
Implemented in XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerErr1, XrdSys::IOEvents::PollPort, XrdSys::IOEvents::PollE, and XrdSys::IOEvents::PollPoll.
| void XrdSys::IOEvents::Poller::Stop | ( | ) |
Stop a poller object. Active callbacks are completed. Pending callbacks are discarded. After which the poller event thread exits. Subsequently, each associated channel is disabled and removed from the poller object. If the channel is enabled for a StopEvent, the stop callback is invoked. However, any attempt to use the channel methods that require an active poller will return an error.
Since a stopped poller cannot be restarted; the only thing left is to delete it. This also applies to all the associated channels since they no longer have an active poller.
References XrdSys::IOEvents::Channel::chCB, XrdSys::IOEvents::Channel::chCBA, XrdSys::IOEvents::Channel::chEvents, XrdSys::IOEvents::Channel::chFD, XrdSys::IOEvents::Channel::chMutex, XrdSys::IOEvents::Channel::chPollXQ, XrdSys::IOEvents::Channel::chStat, close(), XrdSys::IOEvents::Channel::inTOQ, XrdSys::IOEvents::Channel::isClear, XrdSysMutex::Lock(), XrdSys::IOEvents::pollErr1, REMOVE, XrdSys::IOEvents::Poller::PipeData::req, XrdSys::IOEvents::Channel::Reset(), XrdSys::IOEvents::CallBack::Stop(), XrdSys::IOEvents::Channel::stopEvent, and XrdSysMutex::UnLock().
Referenced by XrdCl::PollerBuiltIn::Stop().
| bool XrdSys::IOEvents::Poller::TmoAdd | ( | Channel * | cP | ) | [protected] |
References XrdSys::IOEvents::Channel::chEvents, XrdSys::IOEvents::Channel::deadLine, XrdSys::IOEvents::Channel::dlType, INSERT, XrdSys::IOEvents::Channel::inTOQ, XrdSys::IOEvents::Channel::dlQ::next, XrdSys::IOEvents::Channel::rdDL, XrdSys::IOEvents::Channel::readEvents, XrdSys::IOEvents::CallBack::ReadTimeOut, REMOVE, XrdSys::IOEvents::Channel::tmoList, XrdSys::IOEvents::Channel::wrDL, XrdSys::IOEvents::Channel::writeEvents, and XrdSys::IOEvents::CallBack::WriteTimeOut.
| void XrdSys::IOEvents::Poller::TmoDel | ( | Channel * | cP | ) | [protected] |
References XrdSys::IOEvents::Channel::inTOQ, and REMOVE.
| int XrdSys::IOEvents::Poller::TmoGet | ( | ) | [protected] |
| void XrdSys::IOEvents::Poller::UnLockChannel | ( | Channel * | cP | ) | [inline, protected] |
References XrdSys::IOEvents::Channel::chMutex, and XrdSysMutex::UnLock().
| void XrdSys::IOEvents::Poller::WakeUp | ( | ) | [private] |
friend class BootStrap [friend] |
friend class Channel [friend] |
XrdSysMutex XrdSys::IOEvents::Poller::adMutex [private] |
Channel* XrdSys::IOEvents::Poller::attBase [protected] |
bool XrdSys::IOEvents::Poller::chDead [protected] |
Referenced by XrdSys::IOEvents::Channel::~Channel().
int XrdSys::IOEvents::Poller::cmdFD [protected] |
time_t XrdSys::IOEvents::Poller::maxTime = (sizeof(time_t) == 8 ? 0x7fffffffffffffffLL : 0x7fffffff) [static, protected] |
Referenced by XrdSys::IOEvents::Channel::Enable(), and XrdSys::IOEvents::Channel::Reset().
int XrdSys::IOEvents::Poller::pipeBlen [protected] |
char* XrdSys::IOEvents::Poller::pipeBuff [protected] |
struct pollfd XrdSys::IOEvents::Poller::pipePoll [protected] |
pthread_t XrdSys::IOEvents::Poller::pollTid [protected] |
Referenced by XrdSys::IOEvents::BootStrap::Start(), and XrdSys::IOEvents::Channel::~Channel().
PipeData XrdSys::IOEvents::Poller::reqBuff [protected] |
int XrdSys::IOEvents::Poller::reqFD [protected] |
Channel* XrdSys::IOEvents::Poller::tmoBase [protected] |
bool XrdSys::IOEvents::Poller::wakePend [protected] |
1.7.6.1