A poller implementation using the build-in XRootD poller. More...
#include <XrdClPollerBuiltIn.hh>
Public Member Functions | |
PollerBuiltIn () | |
Constructor. | |
~PollerBuiltIn () | |
virtual bool | Initialize () |
Initialize the poller. | |
virtual bool | Finalize () |
Finalize the poller. | |
virtual bool | Start () |
Start polling. | |
virtual bool | Stop () |
Stop polling. | |
virtual bool | AddSocket (Socket *socket, SocketHandler *handler) |
virtual bool | RemoveSocket (Socket *socket) |
Remove the socket. | |
virtual bool | EnableReadNotification (Socket *socket, bool notify, uint16_t timeout=60) |
virtual bool | EnableWriteNotification (Socket *socket, bool notify, uint16_t timeout=60) |
virtual bool | IsRegistered (Socket *socket) |
Check whether the socket is registered with the poller. | |
virtual bool | IsRunning () const |
Is the event loop running? | |
Private Types | |
typedef std::map< const AnyObject *, std::pair < XrdSys::IOEvents::Poller *, size_t > > | PollerMap |
typedef std::map< Socket *, void * > | SocketMap |
typedef std::vector < XrdSys::IOEvents::Poller * > | PollerPool |
Private Member Functions | |
XrdSys::IOEvents::Poller * | GetNextPoller () |
Goes over poller threads in round robin fashion. | |
XrdSys::IOEvents::Poller * | RegisterAndGetPoller (const Socket *socket) |
Registers given socket as a poller user and returns the poller object. | |
void | UnregisterFromPoller (const Socket *socket) |
Unregisters given socket from poller object. | |
XrdSys::IOEvents::Poller * | GetPoller (const Socket *socket) |
Returns the poller object associated with the given socket. | |
Static Private Member Functions | |
static int | GetNbPollerInit () |
Gets the initial value for 'pNbPoller'. | |
Private Attributes | |
SocketMap | pSocketMap |
PollerMap | pPollerMap |
PollerPool | pPollerPool |
PollerPool::iterator | pNext |
const int | pNbPoller |
XrdSysMutex | pMutex |
A poller implementation using the build-in XRootD poller.
typedef std::map<const AnyObject *, std::pair<XrdSys::IOEvents::Poller *, size_t> > XrdCl::PollerBuiltIn::PollerMap [private] |
typedef std::vector<XrdSys::IOEvents::Poller *> XrdCl::PollerBuiltIn::PollerPool [private] |
typedef std::map<Socket *, void *> XrdCl::PollerBuiltIn::SocketMap [private] |
XrdCl::PollerBuiltIn::PollerBuiltIn | ( | ) | [inline] |
Constructor.
XrdCl::PollerBuiltIn::~PollerBuiltIn | ( | ) | [inline] |
virtual bool XrdCl::PollerBuiltIn::AddSocket | ( | Socket * | socket, | |
SocketHandler * | handler | |||
) | [virtual] |
Add socket to the polling loop
socket | the socket | |
handler | object handling the events |
Implements XrdCl::Poller.
virtual bool XrdCl::PollerBuiltIn::EnableReadNotification | ( | Socket * | socket, | |
bool | notify, | |||
uint16_t | timeout = 60 | |||
) | [virtual] |
Notify the handler about read events
socket | the socket | |
notify | specify if the handler should be notified | |
timeout | if no read event occurred after this time a timeout event will be generated |
Implements XrdCl::Poller.
virtual bool XrdCl::PollerBuiltIn::EnableWriteNotification | ( | Socket * | socket, | |
bool | notify, | |||
uint16_t | timeout = 60 | |||
) | [virtual] |
Notify the handler about write events
socket | the socket | |
notify | specify if the handler should be notified | |
timeout | if no write event occurred after this time a timeout event will be generated |
Implements XrdCl::Poller.
virtual bool XrdCl::PollerBuiltIn::Finalize | ( | ) | [virtual] |
Finalize the poller.
Implements XrdCl::Poller.
static int XrdCl::PollerBuiltIn::GetNbPollerInit | ( | ) | [static, private] |
Gets the initial value for 'pNbPoller'.
XrdSys::IOEvents::Poller* XrdCl::PollerBuiltIn::GetNextPoller | ( | ) | [private] |
Goes over poller threads in round robin fashion.
XrdSys::IOEvents::Poller* XrdCl::PollerBuiltIn::GetPoller | ( | const Socket * | socket | ) | [private] |
Returns the poller object associated with the given socket.
virtual bool XrdCl::PollerBuiltIn::Initialize | ( | ) | [virtual] |
Initialize the poller.
Implements XrdCl::Poller.
virtual bool XrdCl::PollerBuiltIn::IsRegistered | ( | Socket * | socket | ) | [virtual] |
Check whether the socket is registered with the poller.
Implements XrdCl::Poller.
virtual bool XrdCl::PollerBuiltIn::IsRunning | ( | ) | const [inline, virtual] |
XrdSys::IOEvents::Poller* XrdCl::PollerBuiltIn::RegisterAndGetPoller | ( | const Socket * | socket | ) | [private] |
Registers given socket as a poller user and returns the poller object.
virtual bool XrdCl::PollerBuiltIn::RemoveSocket | ( | Socket * | socket | ) | [virtual] |
Remove the socket.
Implements XrdCl::Poller.
virtual bool XrdCl::PollerBuiltIn::Start | ( | ) | [virtual] |
Start polling.
Implements XrdCl::Poller.
virtual bool XrdCl::PollerBuiltIn::Stop | ( | ) | [virtual] |
Stop polling.
Implements XrdCl::Poller.
void XrdCl::PollerBuiltIn::UnregisterFromPoller | ( | const Socket * | socket | ) | [private] |
Unregisters given socket from poller object.
XrdSysMutex XrdCl::PollerBuiltIn::pMutex [private] |
const int XrdCl::PollerBuiltIn::pNbPoller [private] |
PollerPool::iterator XrdCl::PollerBuiltIn::pNext [private] |
PollerMap XrdCl::PollerBuiltIn::pPollerMap [private] |
PollerPool XrdCl::PollerBuiltIn::pPollerPool [private] |
Referenced by IsRunning().
SocketMap XrdCl::PollerBuiltIn::pSocketMap [private] |