21 #ifndef COMMON_IO_KQUEUEPOLLER_H_
22 #define COMMON_IO_KQUEUEPOLLER_H_
25 #include <ola/Clock.h>
28 #include <sys/event.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 enum { CHANGE_SET_SIZE = 10 };
79 typedef std::map<int, KQueueData*> DescriptorMap;
80 typedef std::vector<KQueueData*> DescriptorList;
82 DescriptorMap m_descriptor_map;
88 DescriptorList m_orphaned_descriptors;
90 DescriptorList m_free_descriptors;
96 struct kevent m_change_set[CHANGE_SET_SIZE];
97 unsigned int m_next_change_entry;
102 void CheckDescriptor(
struct kevent *event);
103 std::pair<KQueueData*, bool> LookupOrCreateDescriptor(
int fd);
104 bool ApplyChange(
int fd, int16_t filter, uint16_t flags,
105 KQueueData *kqueue_data,
bool apply_immediately);
106 bool RemoveDescriptor(
int fd, int16_t filter);
108 static const int MAX_EVENTS;
109 static const unsigned int MAX_FREE_DESCRIPTORS;
115 #endif // COMMON_IO_KQUEUEPOLLER_H_