Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 753 Bytes

nanosleep.md

File metadata and controls

38 lines (24 loc) · 753 Bytes

zx_nanosleep

NAME

nanosleep - high resolution sleep

SYNOPSIS

#include <zircon/syscalls.h>

zx_status_t zx_nanosleep(zx_time_t deadline);

DESCRIPTION

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.

To sleep for a duration, use zx_deadline_after and the ZX_<time-unit> helpers:

#include <zircon/syscalls.h> // zx_deadline_after, zx_nanosleep
#include <zircon/types.h> // ZX_MSEC et al.

// Sleep 50 milliseconds
zx_nanosleep(zx_deadline_after(ZX_MSEC(50)));

RIGHTS

No rights are required.

RETURN VALUE

nanosleep() always returns ZX_OK.