
header "sys" as sys

integer PollEvent signed 2 {
    fn is_closed() bool {
        return (this & (sys:POLLHUP | sys:POLLERR)) > 0
    }
    fn is_readable() bool {
        #if OS == win
        return (this & sys:POLLIN) > 0
        #else
        return (this & sys:POLLIN) > 0 && (this & sys:POLLRDHUP) == 0
        #end
    }
    fn is_writable() bool {
        return (this & sys:POLLOUT) > 0
    }
}