linux::timerfd +linux +x86_64

This module provides support for Linux's timerfd interface. For details, consult the Linux man page timer_create(2).



type expiration;
type interval;
type interval_delayed;
type oneshot;


fn new(time::clock, int) (io::file | errors::error);
fn read(io::file) (u64 | errors::error);
fn set(io::file, expiration, int) (void | errors::error);
fn unset(io::file) (void | errors::error);


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

type oneshot = time::duration;

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


fn new[link]

fn new(clockid: time::clock, flags: int) (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 time the timer expired. 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: int) (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.