linux::timerfd+x86_64 +linux

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[link]

type expiration = (oneshot | interval | interval_delayed);

The expiration configuration for the timer.

type interval[link]

type interval = time::duration;

The timer will trigger periodically at the given interval.

type interval_delayed[link]

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[link]

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[link]

type oneshot = time::duration;

The timer will trigger only once, after the set duration and never after.

type set_flag[link]

type set_flag = enum {
	NONE = 0,
	ABSTIME = 1,
	CANCEL_ON_SET = 2,
};

Flags to use in set.

Functions

fn new[link]

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[link]

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[link]

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[link]

fn unset(t: io::file) (void | errors::error);

Unsets any expiration that was previously set on the given timer.