linux::timerfd
Index
Types
type expiration = (oneshot | interval | interval_delayed);
type interval = time::duration;
type interval_delayed = (time::duration, time::duration);
type new_flag = enum {
NONE = 0,
NONBLOCK = rt::O_NONBLOCK,
NOCLOEXEC = rt::O_CLOEXEC,
};
type oneshot = time::duration;
type set_flag = enum {
NONE = 0,
ABSTIME = 1,
CANCEL_ON_SET = 2,
};
Functions
fn new(clockid: time::clock, flags: new_flag) (io::file | errors::error);
fn read(t: io::file) (u64 | errors::error);
fn set(t: io::file, exp: expiration, flags: set_flag) (void | errors::error);
fn unset(t: io::file) (void | errors::error);
Types
type expiration
type expiration = (oneshot | interval | interval_delayed);
The expiration configuration for the timer.
type interval
type interval = time::duration;
The timer will trigger periodically at the given interval.
type interval_delayed
type interval_delayed = (time::duration, time::duration);
The timer will trigger once after a configured delay, then periodically at the given interval.
type new_flag
type new_flag = enum {
NONE = 0,
NONBLOCK = rt::O_NONBLOCK,
NOCLOEXEC = rt::O_CLOEXEC,
};
Flags to use in new. CLOEXEC is enabled by default, use NOCLOEXEC to disable it.
type oneshot
type oneshot = time::duration;
The timer will trigger only once, after the set duration and never after.
type set_flag
type set_flag = enum {
NONE = 0,
ABSTIME = 1,
CANCEL_ON_SET = 2,
};
Flags to use in set.
Functions
fn new
fn new(clockid: time::clock, flags: new_flag) (io::file | errors::error);
Creates a new timerfd. The timer is initially configured without an expiration; see set to configure it.
fn read
fn read(t: io::file) (u64 | errors::error);
Reading from the timerfd returns the number of times the timer has expired since the last call to set or read. This call can be blocking or not depending on the flags passed to new. Reading from a blocking unset timerfd will block forever.
fn set
fn set(t: io::file, exp: expiration, flags: set_flag) (void | errors::error);
Sets the expiration configuration for a timerfd, overwriting any previously set expiration.
fn unset
fn unset(t: io::file) (void | errors::error);
Unsets any expiration that was previously set on the given timer.