#include <XrdSysIOEvents.hh>
◆ EventCode
Event bits used to feed Enable() and Disable(); can be or'd.
Enumerator |
---|
readEvents | Read and Read Timeouts.
|
writeEvents | Write and Write Timeouts.
|
rwEvents | Both of the above.
|
errorEvents | Error event non-r/w specific.
|
stopEvent | Poller stop event.
|
allEvents | All of the above.
|
◆ Status
Enumerator |
---|
isClear | |
isCBMode | |
isDead | |
◆ Channel()
XrdSys::IOEvents::Channel::Channel |
( |
Poller * |
pollP, |
|
|
int |
fd, |
|
|
CallBack * |
cbP = 0 , |
|
|
void * |
cbArg = 0 |
|
) |
| |
Constructor.
- Parameters
-
pollP | Pointer to the poller object to which this channel will be assigned. Events are initially disabled after assignment and no timeout applies. Poller object assignment is permanent for the life of the channel object. |
fd | The associated file descriptor number. It should not be assigned to any other channel and must be valid when the channel is enabled. Use SetFD() to set a new value. |
cbP | Pointer to the callback object (see above). The callback object must not be deleted while associated to a channel. A callback object must exist in order for the channel to be enabled. Use SetCallBack() if you deferred setting it here. |
cbArg | The argument to be passed to the callback object. |
◆ ~Channel()
XrdSys::IOEvents::Channel::~Channel |
( |
| ) |
|
|
inlineprivate |
Destuctor is private, use Delete() to delete this object.
◆ Delete()
void XrdSys::IOEvents::Channel::Delete |
( |
| ) |
|
Delete a channel. You must use this method instead of delete. The Delete() may block if an channel is being deleted outside of the poller thread. When this object is deleted, all events are disabled, pending callbacks are either completed or canceled, and the channel is removed from the assigned poller. Only then is the storage freed.
◆ Disable()
bool XrdSys::IOEvents::Channel::Disable |
( |
int |
events, |
|
|
const char ** |
eText = 0 |
|
) |
| |
Disable one or more events. Ignored for already disabled events.
- Parameters
-
events | one or more events or'd together (see EventCode above). |
eText | optional pointer to where an operation description is to be placed when an error occurs (i.e. returns false). |
- Returns
- true Events successfully disabled. false Events not disabled; errno holds the error number and if eText is supplied, points to the operation desscription.
◆ Enable()
bool XrdSys::IOEvents::Channel::Enable |
( |
int |
events, |
|
|
int |
timeout = 0 , |
|
|
const char ** |
eText = 0 |
|
) |
| |
Enable one or more events. Events that are already enabled remain enabled but may have their timeout value change.
Enable can fail for many reasons. Most importantly, if the channel was disabled for all events when a fatal error occurred; enabling it immediately returns the fatal error without invoking the callback. This happens on platforms that disallow physically masking out error events.
Additionally, when an error occurs and the channel is not enabled for error events but is enabled for read or write, the callback is called indicating ReadyToRead or ReadyToWrite. A subsequent write will then end with an error (typically, EPIPE) and a subsequent read will end with an erorr or indicate zero bytes read; either of which should be treated as an error (typically, POLLHUP). Generally, you should always allow separable error events.
- Parameters
-
events | one or more events or'd together (see EventCode above). |
timeout | >0 maximum seconds that may elapsed before a timeout event corresponding to the specified event(s) occurs. =0 Keep whatever timeout is currently in effect from the previous Enable() invocation for the event(s). <0 No timeout applies. There can be separate timeouts for read and write if Enable() is separately called for each event code. Otherwise, the timeout applies to all specified events. The timeout is ignored for error events. |
eText | optional pointer to where an operation description is to be placed when an error occurs (i.e. returns false). |
- Returns
- true Events successfully enabled. false Events not enabled; errno holds the error number and if eText is supplied, points to the operation desscription.
◆ GetCallBack()
void XrdSys::IOEvents::Channel::GetCallBack |
( |
CallBack ** |
cbP, |
|
|
void ** |
cbArg |
|
) |
| |
Get the callback object and argument associated with this channel.
- Parameters
-
cbP | Place where the pointer is to be returned. |
cbArg | Place where the callback argument is to be returned. |
◆ GetEvents()
int XrdSys::IOEvents::Channel::GetEvents |
( |
| ) |
|
|
inline |
Get the events that are currently enabled for this channel.
- Returns
- >0 Event bits that are enabled (see EventCode above). =0 No events are enabled. <0 Channel not assigned to a Poller object.
References chEvents, and chPoller.
◆ GetFD()
int XrdSys::IOEvents::Channel::GetFD |
( |
| ) |
|
|
inline |
Get the file descriptor number associated with this channel.
- Returns
- >=0 The file descriptor number. < 0 No file desciptor associated with the channel.
References chFD.
◆ Reset()
void XrdSys::IOEvents::Channel::Reset |
( |
Poller * |
thePoller, |
|
|
int |
fd, |
|
|
int |
eNum = 0 |
|
) |
| |
|
private |
◆ SetCallBack()
void XrdSys::IOEvents::Channel::SetCallBack |
( |
CallBack * |
cbP, |
|
|
void * |
cbArg = 0 |
|
) |
| |
Set the callback object and argument associated with this channel.
- Parameters
-
cbP | Pointer to the callback object (see above). The callback object must not be deleted while associated to a channel. A null callback object pointer effectively disables the channel. |
cbArg | The argument to be passed to the callback object. |
◆ SetFD()
void XrdSys::IOEvents::Channel::SetFD |
( |
int |
fd | ) |
|
Set a new file descriptor to be associated with this channel. The channel is removed from polling consideration but remains attached to the poller. The new file descriptor is recorded but the channel remains disabled. You must use Enable() to add the file descriptor back to the polling set. This allows you to retract a file descriptor about to be closed without having a new file descriptor handy (e.g., use -1). This facilitates channel re-use.
- Parameters
-
fd | The associated file descriptor number. |
◆ Poller
◆ attList
dlQ XrdSys::IOEvents::Channel::attList |
|
private |
◆ chCB
CallBack* XrdSys::IOEvents::Channel::chCB |
|
private |
◆ chCBA
void* XrdSys::IOEvents::Channel::chCBA |
|
private |
◆ chEvents
char XrdSys::IOEvents::Channel::chEvents |
|
private |
◆ chFault
short XrdSys::IOEvents::Channel::chFault |
|
private |
◆ chFD
int XrdSys::IOEvents::Channel::chFD |
|
private |
◆ chMutex
◆ chPoller
Poller* XrdSys::IOEvents::Channel::chPoller |
|
private |
◆ chPollXQ
Poller* XrdSys::IOEvents::Channel::chPollXQ |
|
private |
◆ chRTO
int XrdSys::IOEvents::Channel::chRTO |
|
private |
◆ chStat
char XrdSys::IOEvents::Channel::chStat |
|
private |
◆ chWTO
int XrdSys::IOEvents::Channel::chWTO |
|
private |
◆ deadLine
time_t XrdSys::IOEvents::Channel::deadLine |
|
private |
◆ dlType
char XrdSys::IOEvents::Channel::dlType |
|
private |
◆ inPSet
char XrdSys::IOEvents::Channel::inPSet |
|
private |
◆ inTOQ
char XrdSys::IOEvents::Channel::inTOQ |
|
private |
◆ pollEnt
int XrdSys::IOEvents::Channel::pollEnt |
|
private |
◆ rdDL
time_t XrdSys::IOEvents::Channel::rdDL |
|
private |
◆ reMod
char XrdSys::IOEvents::Channel::reMod |
|
private |
◆ tmoList
dlQ XrdSys::IOEvents::Channel::tmoList |
|
private |
◆ wrDL
time_t XrdSys::IOEvents::Channel::wrDL |
|
private |
The documentation for this class was generated from the following file: