Function epoll_wait [src]
Waits for an I/O event on an epoll file descriptor.
Returns the number of file descriptors ready for the requested I/O,
or zero if no file descriptor became ready during the requested timeout milliseconds.
Prototype
pub fn epoll_wait(epfd: i32, events: []system.epoll_event, timeout: i32) usize
Parameters
epfd: i32
events: []system.epoll_event
timeout: i32
Source
pub fn epoll_wait(epfd: i32, events: []system.epoll_event, timeout: i32) usize {
while (true) {
// TODO get rid of the @intCast
const rc = system.epoll_wait(epfd, events.ptr, @intCast(events.len), timeout);
switch (errno(rc)) {
.SUCCESS => return @intCast(rc),
.INTR => continue,
.BADF => unreachable,
.FAULT => unreachable,
.INVAL => unreachable,
else => unreachable,
}
}
}