LICENSE NEWS README TODO
SleepyPenguin Epoll Epoll::IO Ev EvFilt EventFD Inotify Inotify::Event Kevent Kqueue Kqueue::IO Note TimerFD VQ

Methods

::new #expirations #gettime #settime

class SleepyPenguin::TimerFD

TimerFD exposes kernel timers as IO objects that may be monitored by IO.select or Epoll. IO#close disarms the timers and returns resources back to the kernel.

Public Class Methods

TimerFD.new([clockid[, flags]]) -> TimerFD IO object source

Creates a new timer as an IO object.

If set clockid must be be one of the following:

clockid defaults to :MONOTONIC if unspecified flags may be any or none of the following:

Public Instance Methods

tfd.expirations([nonblock])          -> Integer source

Returns the number of expirations that have occurred. This will block if no expirations have occurred at the time of the call. Returns nil if nonblock is passed and is true

tfd#gettime  -> [ interval, value ] source

Returns the current interval and value of the timer as an Array.

tfd.settime(flags, interval, value) -> [ old_interval, old_value ] source

Arms (starts) or disarms (stops) the timer referred by the TimerFD object and returns the old value of the timer.

flags is either zero (or nil) to start a relative timer or :ABSTIME to start an absolute timer. If the interval is zero, the timer fires only once, otherwise the timer is fired every interval seconds. value is the time of the initial expiration in seconds.

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