|
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) |
|
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.
bool XrdSys::IOEvents::Poller::CbkXeq |
( |
Channel * |
cP, |
|
|
int |
events, |
|
|
int |
eNum, |
|
|
const char * |
eTxt |
|
) |
| |
|
protected |
Definition at line 636 of file XrdSysIOEvents.cc.
641 bool cbok, retval, isRead, isWrite, isLocked =
true;
646 {
const char *cbtype = (cP->chPoller == cP->chPollXQ ?
"norm" :
647 (cP->chPoller == &
pollInit ?
"init" :
648 (cP->chPoller == &
pollWait ?
"wait" :
"err")));
650 <<
" chev=" <<
static_cast<int>(cP->chEvents)
651 <<
" toq=" <<(cP->inTOQ != 0) <<
" erc=" <<eNum
652 <<
" callback " <<(cP->chCB ?
"present" :
"missing")
653 <<
" poller=" <<cbtype);
663 if (isRead) cP->rdDL =
maxTime;
665 if (isWrite) cP->wrDL =
maxTime;
668 isRead = isWrite =
false;
676 if (!(cP->chCB) || cP->chPoller != cP->chPollXQ)
678 {cP->chPoller = &
pollErr1; cP->chFault = eNum;
682 oldEvents = cP->chEvents;
684 retval = cP->chPoller->
Modify(cP, eNum, 0, isLocked);
686 if (!isLocked) cP->chMutex.Lock();
687 cP->chEvents = oldEvents;
697 {cP->chPoller = &
pollErr1; cP->chFault = eNum;
698 cP->chStat = Channel::isCBMode;
701 cP->chCB->Fatal(cP,cP->chCBA, eNum, eTxt);
703 cbkMHelp.Lock(&(cP->chMutex));
709 else {cP->chPoller = &
pollErr1; cP->chFault = eNum; cP->inPSet = 0;
717 cP->chStat = Channel::isCBMode;
721 cbok = cP->chCB->Event(cP,cP->chCBA, events);
728 cbkMHelp.Lock(&(cP->chMutex));
733 if (cP->chStat != Channel::isCBMode)
734 {
if (cP->chStat == Channel::isDead)
738 cP->chStat = Channel::isClear;
743 if (!cbok) Detach(cP,isLocked,
false);
744 else if ((isRead || isWrite) && !(cP->inTOQ) && (cP->chRTO || cP->chWTO))
750 if (!isLocked) cP->chMutex.Lock();
#define IF_TRACE(x, fd, y)
#define DO_TRACE(x, fd, y)
#define TRACE_MOD(x, fd, y)
@ ReadyToWrite
Writing won't block.
@ ReadyToRead
New data has arrived.
@ ReadTimeOut
Read timeout.
@ WriteTimeOut
Write timeout.
@ ValidEvents
Mask to test for valid events.
@ errorEvents
Error event non-r/w specific.
bool Modify(Channel *cP, int &eNum, const char **eTxt, bool &isLocked)
bool TmoAdd(Channel *cP, int tmoSet)
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.
bool XrdSys::IOEvents::Poller::Init |
( |
Channel * |
cP, |
|
|
int & |
eNum, |
|
|
const char ** |
eTxt, |
|
|
bool & |
isLockd |
|
) |
| |
|
protected |
Definition at line 905 of file XrdSysIOEvents.cc.
917 {cP->reMod = cP->chEvents;
925 IF_TRACE(
Init,cP->chFD,
"begin events=" <<
int(cP->chEvents));
929 if (!(cP->chEvents))
return true;
934 {eNum = EDESTADDRREQ;
935 if (eTxt) *eTxt =
"enabling without a callback";
942 cP->chPoller = &
pollWait; cP->reMod = cP->chEvents; cP->chEvents = 0;
943 retval = cP->chPollXQ->
Include(cP, eNum, eTxt, isLocked);
945 if (!isLocked) {cP->chMutex.Lock(); isLocked =
true;}
951 if (!retval) {cP->chPoller = &
pollErr1; cP->chFault = eNum;}
952 else {cP->chPoller = cP->chPollXQ;
955 {cP->chEvents = cP->reMod;
956 retval = cP->chPoller->
Modify(cP, eNum, eTxt, isLocked);
958 if (!isLocked) {cP->chMutex.Lock(); isLocked =
true;}
#define TRACE_NOD(x, fd, y)
bool Include(Channel *cP, int &eNum, const char **eTxt, bool &isLocked)
bool Init(Channel *cP, int &eNum, const char **eTxt, bool &isLockd)
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().
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.
1036 memset(
static_cast<void*
>( &cmdbuff ), 0,
sizeof(cmdbuff));
1066 if (cP->inTOQ)
TmoDel(cP);
1067 cP->Reset(&
pollErr1, cP->chFD, EIDRM);
1070 {cP->chStat = Channel::isClear;
1071 theCB = cP->chCB; cbArg = cP->chCBA;
1072 cP->chMutex.UnLock();
1073 theCB->
Stop(cP, cbArg);
1074 }
else cP->chMutex.UnLock();
#define REMOVE(dlbase, dlvar, curitem)
@ stopEvent
Poller stop event.
int SendCmd(PipeData &cmd)
virtual void Shutdown()=0
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().