Epoll::IO
is a low-level class. It does not provide fork nor GC-safety, so Ruby IO
objects added via epoll_ctl
must be retained by the application until IO#close is called.
SleepyPenguin::Epoll::IO.new(flags) -> Epoll::IO object source
Creates a new Epoll::IO
object with the given flags
argument. flags
may currently be CLOEXEC
or 0
.
epoll_io.epoll_ctl(op, io, events) -> nil source
Register, modify, or register a watch for a given io
for events.
op
may be one of EPOLL_CTL_ADD
, EPOLL_CTL_MOD
, or EPOLL_CTL_DEL
io
is an IO
object or one which proxies via the to_io
method. events
is an integer mask of events to watch for.
Returns nil on success.
ep_io.epoll_wait([maxevents[, timeout]]) { |events, io| ... } source
Calls epoll_wait
(2) and yields Integer events
and IO
objects watched for. maxevents
is the maximum number of events to process at once, lower numbers may prevent starvation when used by epoll_wait
in multiple threads. Larger maxevents
reduces syscall overhead for single-threaded applications. maxevents
defaults to 64 events. timeout
is specified in milliseconds, nil
(the default) meaning it will block and wait indefinitely.
Parent: IO
Pages
Classes
Methods
mail archives: https://yhbt.net/sleepy-penguin/ public: sleepy-penguin@yhbt.net source code: git clone https://yhbt.net/sleepy_penguin.git