zx_nanosleep

NAME

High resolution sleep.

SYNOPSIS

  1. #include <zircon/syscalls.h>
  2. zx_status_t zx_nanosleep(zx_time_t deadline);

DESCRIPTION

zx_nanosleep() suspends the calling thread execution until deadline passes on ZX_CLOCK_MONOTONIC. A deadline value less than or equal to 0 immediately yields the thread. deadline will be automatically adjusted according to the job’s timer slack policy.

To sleep for a duration, use zx_deadline_after() and the ZX_\ helpers:

  1. #include <zircon/syscalls.h> // zx_deadline_after, zx_nanosleep
  2. #include <zircon/types.h> // ZX_MSEC et al.
  3. // Sleep 50 milliseconds
  4. zx_nanosleep(zx_deadline_after(ZX_MSEC(50)));

RIGHTS

None.

RETURN VALUE

zx_nanosleep() always returns ZX_OK.

SEE ALSO