21 #ifndef COMMON_IO_EPOLLER_H_
22 #define COMMON_IO_EPOLLER_H_
25 #include <ola/Clock.h>
28 #include <sys/epoll.h>
36 #include "common/io/PollerInterface.h"
37 #include "common/io/TimeoutManager.h"
64 bool delete_on_close);
71 const TimeStamp *WakeUpTime()
const {
return &m_wake_up_time; }
77 typedef std::map<int, EPollData*> DescriptorMap;
78 typedef std::vector<EPollData*> DescriptorList;
80 DescriptorMap m_descriptor_map;
86 DescriptorList m_orphaned_descriptors;
88 DescriptorList m_free_descriptors;
96 std::pair<EPollData*, bool> LookupOrCreateDescriptor(
int fd);
98 bool RemoveDescriptor(
int fd,
int event,
bool warn_on_missing);
99 void CheckDescriptor(
struct epoll_event *event,
EPollData *descriptor);
101 static const int MAX_EVENTS;
102 static const int READ_FLAGS;
103 static const unsigned int MAX_FREE_DESCRIPTORS;
105 DISALLOW_COPY_AND_ASSIGN(
EPoller);
109 #endif // COMMON_IO_EPOLLER_H_
bool RemoveReadDescriptor(class ReadFileDescriptor *descriptor)
Unregister a ReadFileDescriptor for read events.
Definition: EPoller.cpp:245
Manages timer events.
Definition: TimeoutManager.h:45
An implementation of PollerInterface that uses epoll().
Definition: EPoller.h:51
bool AddReadDescriptor(class ReadFileDescriptor *descriptor)
Register a ReadFileDescriptor for read events.
Definition: EPoller.cpp:186
A container for the exported variables.
Definition: ExportMap.h:324
A BidirectionalFileDescriptor that also generates notifications when closed.
Definition: Descriptor.h:282
bool Poll(TimeoutManager *timeout_manager, const TimeInterval &poll_interval)
Poll the Descriptors for events and execute any callbacks.
Definition: EPoller.cpp:287
Definition: ExportMap.h:176
Export variables on the http server.
bool RemoveWriteDescriptor(class WriteFileDescriptor *descriptor)
Unregister a WriteFileDescriptor for write events.
Definition: EPoller.cpp:283
Used to get the current time.
Definition: Clock.h:221
Definition: EPoller.cpp:46
Represents a file descriptor that supports reading data.
Definition: Descriptor.h:140
EPoller(ExportMap *export_map, Clock *clock)
Create a new EPoller.
Definition: EPoller.cpp:142
bool AddWriteDescriptor(class WriteFileDescriptor *descriptor)
Register a WriteFileDescriptor to receive ready-to-write events.
Definition: EPoller.cpp:253
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
The interface for the Poller classes.
Definition: PollerInterface.h:70
Represents a file descriptor that supports writing data.
Definition: Descriptor.h:170