|
| 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 637 of file XrdSysIOEvents.cc.
642 bool cbok, retval, isRead, isWrite, isLocked =
true;
647 {
const char *cbtype = (cP->chPoller == cP->chPollXQ ?
"norm" :
648 (cP->chPoller == &
pollInit ?
"init" :
649 (cP->chPoller == &
pollWait ?
"wait" :
"err")));
651 <<
" chev=" <<
static_cast<int>(cP->chEvents)
652 <<
" toq=" <<(cP->inTOQ != 0) <<
" erc=" <<eNum
653 <<
" callback " <<(cP->chCB ?
"present" :
"missing")
654 <<
" poller=" <<cbtype);
664 if (isRead) cP->rdDL =
maxTime;
666 if (isWrite) cP->wrDL =
maxTime;
669 isRead = isWrite =
false;
677 if (!(cP->chCB) || cP->chPoller != cP->chPollXQ)
679 {cP->chPoller = &
pollErr1; cP->chFault = eNum;
683 oldEvents = cP->chEvents;
685 retval = cP->chPoller->
Modify(cP, eNum, 0, isLocked);
687 if (!isLocked) cP->chMutex.Lock();
688 cP->chEvents = oldEvents;
698 {cP->chPoller = &
pollErr1; cP->chFault = eNum;
699 cP->chStat = Channel::isCBMode;
702 cP->chCB->Fatal(cP,cP->chCBA, eNum, eTxt);
704 cbkMHelp.Lock(&(cP->chMutex));
710 else {cP->chPoller = &
pollErr1; cP->chFault = eNum; cP->inPSet = 0;
718 cP->chStat = Channel::isCBMode;
722 CallBack *cb = cP->chCB;
723 void *cba = cP->chCBA;
726 cbok = cb->Event(cP,cba, events);
733 cbkMHelp.Lock(&(cP->chMutex));
738 if (cP->chStat != Channel::isCBMode)
739 {
if (cP->chStat == Channel::isDead)
747 cP->chStat = Channel::isClear;
752 if (!cbok) Detach(cP,isLocked,
false);
753 else if ((isRead || isWrite) && !(cP->inTOQ) && (cP->chRTO || cP->chWTO))
759 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, XrdSysSemaphore::Post(), 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 914 of file XrdSysIOEvents.cc.
926 {cP->reMod = cP->chEvents;
934 IF_TRACE(
Init,cP->chFD,
"begin events=" <<
int(cP->chEvents));
938 if (!(cP->chEvents))
return true;
943 {eNum = EDESTADDRREQ;
944 if (eTxt) *eTxt =
"enabling without a callback";
951 cP->chPoller = &
pollWait; cP->reMod = cP->chEvents; cP->chEvents = 0;
952 retval = cP->chPollXQ->
Include(cP, eNum, eTxt, isLocked);
954 if (!isLocked) {cP->chMutex.Lock(); isLocked =
true;}
960 if (!retval) {cP->chPoller = &
pollErr1; cP->chFault = eNum;}
961 else {cP->chPoller = cP->chPollXQ;
964 {cP->chEvents = cP->reMod;
965 retval = cP->chPoller->
Modify(cP, eNum, eTxt, isLocked);
967 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 1035 of file XrdSysIOEvents.cc.
1045 memset(
static_cast<void*
>( &cmdbuff ), 0,
sizeof(cmdbuff));
1075 if (cP->inTOQ)
TmoDel(cP);
1076 cP->Reset(&
pollErr1, cP->chFD, EIDRM);
1079 {cP->chStat = Channel::isClear;
1080 theCB = cP->chCB; cbArg = cP->chCBA;
1081 cP->chMutex.UnLock();
1082 theCB->
Stop(cP, cbArg);
1083 }
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().