25 #ifndef CARGO_IPC_EPOLL_EVENT_POLL_HPP
26 #define CARGO_IPC_EPOLL_EVENT_POLL_HPP
32 #include <unordered_map>
56 typedef std::function<void(int fd, Events events)>
Callback;
113 std::unordered_map<int, std::shared_ptr<Callback>>
mCallbacks;
125 #endif // CARGO_IPC_EPOLL_EVENT_POLL_HPP
std::function< void(int fd, Events events)> Callback
Generic function type used as callback for epoll events.
Definition: event-poll.hpp:56
std::unordered_map< int, std::shared_ptr< Callback > > mCallbacks
Definition: event-poll.hpp:113
bool dispatchIteration(const int timeoutMs)
Wait for events on descriptor on the watch list.
Definition: event-poll.cpp:113
void modifyFD(const int fd, const Events events)
Modify watched events for descriptor.
Definition: event-poll.cpp:89
const int mPollFD
Definition: event-poll.hpp:111
bool modifyFDInternal(const int fd, const Events events)
Definition: event-poll.cpp:165
std::recursive_mutex Mutex
Definition: event-poll.hpp:109
Mutex mMutex
Definition: event-poll.hpp:112
void removeFD(const int fd)
Remove descriptor from the watch list.
Definition: event-poll.cpp:99
void removeFDInternal(const int fd)
Definition: event-poll.cpp:179
int getPollFD() const
Returns epoll handle.
Definition: event-poll.cpp:64
~EventPoll()
Definition: event-poll.cpp:52
unsigned int Events
bitmask of EPOLL* constants
Definition: events.hpp:39
This class waits on registered file descriptor for events.
Definition: event-poll.hpp:47
void addFD(const int fd, const Events events, Callback &&callback)
Add descriptor and it's watched events.
Definition: event-poll.cpp:69
EventPoll()
Constructs the EventPoll and initializes the underlaying epoll mechanism.
Definition: event-poll.cpp:42
bool addFDInternal(const int fd, const Events events)
Definition: event-poll.cpp:151