Arquivos
Carlos Pizano 4dfc8d0063 [kernel][magenta] Add slack options to timers
The long requested feature now exposed to user mode. Now
the timer slack and be early, center or late.

The default behavior of 0 is "center" which was the existing
behavior so there no effective change on the existing
build.

Tests included with the caveat that better tests
exist already via "k timer_tests".

Change-Id: If1787e30eda4c06be003dea715e92c3f240841ca
2017-08-25 14:57:16 +00:00

1.4 KiB

mx_timer_create

NAME

timer_create - create a timer

SYNOPSIS

#include <magenta/syscalls.h>

mx_status_t mx_timer_create(uint32_t options, uint32_t clock_id, mx_handle_t* out);

DESCRIPTION

timer_create() creates a timer, an object that can signal when a specified point in time has been reached. The only valid clock_id is MX_CLOCK_MONOTONIC.

The options value specifies the coalescing behavior which controls whether the system can fire the time earlier or later depending on other pending timers.

The possible values are:

  • MX_TIMER_SLACK_CENTER coalescing is allowed with earlier and later timers.
  • MX_TIMER_SLACK_EARLY coalescing is allowed only with earlier timers.
  • MX_TIMER_SLACK_LAYE coalescing is allowed only with later timers.

Passing 0 in options is equivalent to MX_TIMER_SLACK_CENTER.

The returned handle has the MX_RIGHT_DUPLICATE, MX_RIGHT_TRANSFER, MX_RIGHT_READ and MX_RIGHT_WRITE right.

RETURN VALUE

timer_create() returns MX_OK on success. In the event of failure, a negative error value is returned.

ERRORS

MX_ERR_INVALID_ARGS out is an invalid pointer or NULL or options is not one of the MX_TIMER_SLACK values or clock_id is any value other than MX_CLOCK_MONOTONIC.

MX_ERR_NO_MEMORY (Temporary) Failure due to lack of memory.

SEE ALSO

timer_set, timer_cancel, deadline_after, handle_close