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.
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:
:REALTIME - use the settable clock
:MONOTONIC - use the non-settable clock unaffected by manual changes
clockid defaults to :MONOTONIC if unspecified flags may be any or none of the following:
:CLOEXEC - set the close-on-exec flag on the new object
:NONBLOCK - set the non-blocking I/O flag on the new object
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