![]() |
XRootD
|
#include <XrdSysIOEvents.hh>
Classes | |
struct | PipeData |
Public Types | |
enum | CreateOpts { optTOM } |
Public Member Functions | |
Poller (int cFD, int rFD) | |
virtual | ~Poller () |
Destructor. Stop() is effecively called when this object is deleted. | |
void | Stop () |
Static Public Member Functions | |
static Poller * | Create (int &eNum, const char **eTxt=0, int crOpts=0) |
Protected Member Functions | |
virtual void | Begin (XrdSysSemaphore *syncp, int &rc, const char **eTxt)=0 |
void | CbkTMO () |
bool | CbkXeq (Channel *cP, int events, int eNum, const char *eTxt) |
CPP_ATOMIC_TYPE (bool) wakePend | |
virtual void | Exclude (Channel *cP, bool &isLocked, bool dover=1)=0 |
int | GetFault (Channel *cP) |
int | GetPollEnt (Channel *cP) |
int | GetRequest () |
virtual bool | Include (Channel *cP, int &eNum, const char **eTxt, bool &isLocked)=0 |
bool | Init (Channel *cP, int &eNum, const char **eTxt, bool &isLockd) |
void | LockChannel (Channel *cP) |
virtual bool | Modify (Channel *cP, int &eNum, const char **eTxt, bool &isLocked)=0 |
int | Poll2Enum (short events) |
int | SendCmd (PipeData &cmd) |
void | SetPollEnt (Channel *cP, int ptEnt) |
virtual void | Shutdown ()=0 |
bool | TmoAdd (Channel *cP, int tmoSet) |
void | TmoDel (Channel *cP) |
int | TmoGet () |
void | UnLockChannel (Channel *cP) |
Protected Attributes | |
Channel * | attBase |
bool | chDead |
int | cmdFD |
int | pipeBlen |
char * | pipeBuff |
struct pollfd | pipePoll |
pthread_t | pollTid |
PipeData | reqBuff |
int | reqFD |
Channel * | tmoBase |
unsigned char | tmoMask |
Static Protected Attributes | |
static time_t | maxTime = (sizeof(time_t) == 8 ? 0x7fffffffffffffffLL : 0x7fffffff) |
static pid_t | parentPID = getpid() |
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.
Definition at line 371 of file XrdSysIOEvents.hh.
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. |
crOpts | Poller options (see static const optxxx): optTOM - Timeout resumption after a timeout event must be manually reenabled. By default, event timeouts are automatically renabled after successful callbacks. |
Enumerator | |
---|---|
optTOM |
Definition at line 398 of file XrdSysIOEvents.hh.
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. |
Definition at line 571 of file XrdSysIOEvents.cc.
|
inlinevirtual |
Destructor. Stop() is effecively called when this object is deleted.
Definition at line 430 of file XrdSysIOEvents.hh.
|
protectedpure 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::PollE, XrdSys::IOEvents::PollKQ, XrdSys::IOEvents::PollPoll, XrdSys::IOEvents::PollPort, XrdSys::IOEvents::PollerErr1, XrdSys::IOEvents::PollerInit, and XrdSys::IOEvents::PollerWait.
Referenced by XrdSys::IOEvents::BootStrap::Start().
|
protected |
Definition at line 614 of file XrdSysIOEvents.cc.
|
protected |
Definition at line 636 of file XrdSysIOEvents.cc.
References BOOLNAME, DO_TRACE, XrdSys::IOEvents::Channel::errorEvents, XrdSys::IOEvents::CallBack::Event(), XrdSys::IOEvents::CallBack::Fatal(), IF_TRACE, XrdSysMutex::Lock(), XrdSysMutexHelper::Lock(), Modify(), XrdSys::IOEvents::pollErr1, XrdSys::IOEvents::pollInit, XrdSys::IOEvents::pollWait, XrdSys::IOEvents::CallBack::ReadTimeOut, XrdSys::IOEvents::CallBack::ReadyToRead, XrdSys::IOEvents::CallBack::ReadyToWrite, REVENTS, TRACE_MOD, TRACING, XrdSysMutexHelper::UnLock(), XrdSys::IOEvents::CallBack::ValidEvents, WEVENTS, and XrdSys::IOEvents::CallBack::WriteTimeOut.
|
protected |
|
static |
Definition at line 758 of file XrdSysIOEvents.cc.
References close, XrdSys::IOEvents::pollArg::pollP, XrdSys::IOEvents::pollArg::pollSync, XrdSys::IOEvents::CallBack::ReadTimeOut, XrdSys::IOEvents::pollArg::retCode, XrdSys::IOEvents::pollArg::retMsg, XrdSysThread::Run(), XrdSys::IOEvents::BootStrap::Start(), tmoMask, XrdSysSemaphore::Wait(), XrdSys::IOEvents::CallBack::WriteTimeOut, and XRDSYSTHREAD_BIND.
|
protectedpure 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::PollerErr1, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollE, XrdSys::IOEvents::PollKQ, XrdSys::IOEvents::PollPoll, and XrdSys::IOEvents::PollPort.
|
inlineprotected |
Definition at line 437 of file XrdSysIOEvents.hh.
Referenced by XrdSys::IOEvents::PollerErr1::Include(), and XrdSys::IOEvents::PollerErr1::Modify().
|
inlineprotected |
Definition at line 438 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 866 of file XrdSysIOEvents.cc.
References read, and XrdSysE2T().
|
protectedpure 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::PollerErr1, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollE, XrdSys::IOEvents::PollKQ, XrdSys::IOEvents::PollPoll, and XrdSys::IOEvents::PollPort.
Referenced by Init().
|
protected |
Definition at line 905 of file XrdSysIOEvents.cc.
References BOOLNAME, IF_TRACE, Include(), XrdSysMutex::Lock(), Modify(), XrdSys::IOEvents::pollErr1, XrdSys::IOEvents::pollWait, TRACE_LOK, TRACE_MOD, and TRACE_NOD.
Referenced by XrdSys::IOEvents::PollerInit::Modify(), and XrdSys::IOEvents::PollerWait::Modify().
|
inlineprotected |
Definition at line 441 of file XrdSysIOEvents.hh.
References XrdSysMutex::Lock().
|
protectedpure 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::PollerErr1, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollE, XrdSys::IOEvents::PollKQ, XrdSys::IOEvents::PollPoll, and XrdSys::IOEvents::PollPort.
Referenced by CbkXeq(), and Init().
|
protected |
Definition at line 974 of file XrdSysIOEvents.cc.
|
protected |
Definition at line 989 of file XrdSysIOEvents.cc.
References XrdSys::IOEvents::Poller::PipeData::req, XrdSys::IOEvents::Poller::PipeData::theSem, XrdSysSemaphore::Wait(), and write.
|
protected |
Definition at line 1017 of file XrdSysIOEvents.cc.
|
protectedpure 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::PollerErr1, XrdSys::IOEvents::PollerInit, XrdSys::IOEvents::PollerWait, XrdSys::IOEvents::PollE, XrdSys::IOEvents::PollKQ, XrdSys::IOEvents::PollPoll, and XrdSys::IOEvents::PollPort.
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.
Definition at line 1026 of file XrdSysIOEvents.cc.
References close, XrdSysMutex::Lock(), XrdSys::IOEvents::pollErr1, REMOVE, XrdSys::IOEvents::Poller::PipeData::req, XrdSys::IOEvents::CallBack::Stop(), XrdSys::IOEvents::Channel::stopEvent, and XrdSysMutex::UnLock().
Referenced by XrdSys::IOEvents::PollE::~PollE(), XrdSys::IOEvents::PollKQ::~PollKQ(), XrdSys::IOEvents::PollPoll::~PollPoll(), XrdSys::IOEvents::PollPort::~PollPort(), and XrdCl::PollerBuiltIn::Stop().
|
protected |
Definition at line 1088 of file XrdSysIOEvents.cc.
References BOOLNAME, IF_TRACE, INSERT, XrdSys::IOEvents::CallBack::ReadTimeOut, XrdSys::IOEvents::CallBack::ReadyToRead, XrdSys::IOEvents::CallBack::ReadyToWrite, REMOVE, REVENTS, STATUSOF, WEVENTS, and XrdSys::IOEvents::CallBack::WriteTimeOut.
|
protected |
Definition at line 1156 of file XrdSysIOEvents.cc.
|
protected |
Definition at line 1176 of file XrdSysIOEvents.cc.
References CPP_ATOMIC_STORE.
Referenced by XrdSys::IOEvents::PollPort::BegTO().
|
inlineprotected |
Definition at line 448 of file XrdSysIOEvents.hh.
References XrdSysMutex::UnLock().
|
friend |
Definition at line 373 of file XrdSysIOEvents.hh.
|
friend |
Definition at line 374 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 488 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 511 of file XrdSysIOEvents.hh.
Referenced by XrdSys::IOEvents::Channel::Delete().
|
protected |
Definition at line 494 of file XrdSysIOEvents.hh.
|
staticprotected |
Definition at line 513 of file XrdSysIOEvents.hh.
Referenced by XrdSys::IOEvents::Channel::Enable().
|
staticprotected |
Definition at line 515 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 508 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 507 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 493 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 491 of file XrdSysIOEvents.hh.
Referenced by XrdSys::IOEvents::Channel::Delete(), and XrdSys::IOEvents::BootStrap::Start().
|
protected |
Definition at line 506 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 495 of file XrdSysIOEvents.hh.
Referenced by XrdSys::IOEvents::PollKQ::PollKQ().
|
protected |
Definition at line 489 of file XrdSysIOEvents.hh.
|
protected |
Definition at line 509 of file XrdSysIOEvents.hh.
Referenced by Create().