xrootd
Public Member Functions | Private Types | Private Attributes
XrdCl::PollerLibEvent Class Reference

A poller implementation using libEvent underneath. More...

#include <XrdClPollerLibEvent.hh>

Inheritance diagram for XrdCl::PollerLibEvent:
Inheritance graph
[legend]
Collaboration diagram for XrdCl::PollerLibEvent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PollerLibEvent ()
 Constructor.
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?
int RunEventLoop ()
 Run the libevent event loop.

Private Types

typedef std::map< const Socket
*, void * > 
SocketMap

Private Attributes

SocketMap pSocketMap
XrdSysMutex pMutex
event_base * pEventBase
pthread_t pPollerThread
bool pPollerThreadRunning

Detailed Description

A poller implementation using libEvent underneath.


Member Typedef Documentation

typedef std::map<const Socket *, void *> XrdCl::PollerLibEvent::SocketMap [private]

Constructor & Destructor Documentation

Constructor.


Member Function Documentation

bool XrdCl::PollerLibEvent::AddSocket ( Socket *  socket,
SocketHandler *  handler 
) [virtual]
bool XrdCl::PollerLibEvent::EnableReadNotification ( Socket *  socket,
bool  notify,
uint16_t  timeout = 60 
) [virtual]

Notify the handler about read events

Parameters:
socketthe socket
notifyspecify if the handler should be notified
timeoutif no read event occurred after this time a timeout event will be generated

Implements XrdCl::Poller.

References XrdCl::Log::Dump(), XrdCl::Log::Error(), XrdCl::Socket::GetFD(), XrdCl::DefaultEnv::GetLog(), XrdCl::Socket::GetName(), pEventBase, pMutex, XrdCl::PollerMsg, pSocketMap, ReadEventCallback(), and XrdCl::Log::Warning().

bool XrdCl::PollerLibEvent::EnableWriteNotification ( Socket *  socket,
bool  notify,
uint16_t  timeout = 60 
) [virtual]

Notify the handler about write events

Parameters:
socketthe socket
notifyspecify if the handler should be notified
timeoutif no write event occurred after this time a timeout event will be generated

Implements XrdCl::Poller.

References XrdCl::Log::Dump(), XrdCl::Log::Error(), XrdCl::Socket::GetFD(), XrdCl::DefaultEnv::GetLog(), XrdCl::Socket::GetName(), pEventBase, pMutex, XrdCl::PollerMsg, pSocketMap, XrdCl::Log::Warning(), and WriteEventCallback().

bool XrdCl::PollerLibEvent::Finalize ( ) [virtual]

Finalize the poller.

Implements XrdCl::Poller.

References IsRunning(), pEventBase, pSocketMap, and Stop().

bool XrdCl::PollerLibEvent::IsRegistered ( Socket *  socket) [virtual]

Check whether the socket is registered with the poller.

Implements XrdCl::Poller.

References pMutex, and pSocketMap.

virtual bool XrdCl::PollerLibEvent::IsRunning ( ) const [inline, virtual]

Is the event loop running?

Implements XrdCl::Poller.

References pPollerThreadRunning.

Referenced by Finalize().

bool XrdCl::PollerLibEvent::RemoveSocket ( Socket *  socket) [virtual]
bool XrdCl::PollerLibEvent::Start ( ) [virtual]
bool XrdCl::PollerLibEvent::Stop ( ) [virtual]

Member Data Documentation

event_base* XrdCl::PollerLibEvent::pEventBase [private]

Referenced by Start(), and Stop().

Referenced by IsRunning(), Start(), and Stop().


The documentation for this class was generated from the following files: