epoll_createsyscall creates an epoll instance and returns a file handle to us.
epoll_ctlsyscall is used to add, modify or remove events from the event queue.
epoll_waitsyscall suspends (deschedules) the thread it's called from, thereby blocking any further progress on that thread until either an event has occurred or a provided
epollthis system call creates an
eventfdobject that can be used as an event "notify" mechanism. In other words, this lets us issue an timeout event which wakes up the thread which is waiting after calling the
epoll_waitsyscall. We are going to use this to be able to wake up our thread when we want to close the event queue and clean up after ourselves.
closesyscall closes a file descriptor so it no longer points to a resource and can be reused.
Eventstruct represents information about an event we want to register interest about. Specifically, what kind of events we want to register interest for like
epoll. We only need very few since we're just covering one small use case, but these will at least get you started to get something working.
OR-ing different flags together. This is a pretty common way of describing a set of options in C. Read more about bitflags in the paragraph about them in the Appendix.