Ожидать без блокировки в течение заданного промежутка времени
#include <time.h>int nanospin_ns( unsigned long nsec );
libc
The nanospin_ns() function busy-waits for the number of nanoseconds specified in nsec, without blocking the calling thread.
![]() | The nanospin*() functions are designed for use with hardware that requires short time delays between accesses. You should use them to delay only for times less than a few milliseconds. For longer delays, use the POSIX timer_*() functions.
Because of the nature of time measurement, the function might actually wait longer than the specified time. |
The first time you call nanospin_ns(), the C library invokes nanospin_calibrate() with an argument of 0
(interrupts enabled), if you haven't invoked it directly first.
500
milliseconds. ![]() | A delay of more than a few milliseconds might not work on some processors. For longer delays, use the POSIX timer_*() functions. |
startup-*
program didn't initialize the timing information necessary to use nanospin_ns().ЗОСРВ «Нейтрино»
You should use busy-waiting only when absolutely necessary for accessing hardware.
It isn't safe to call this function in an interrupt handler if nanospin_calibrate() hasn't been called yet.
nanosleep(), nanospin(), nanospin_calibrate(), nanospin_count(), nanospin_ns_to_count(), sched_yield(), sleep(), timer_create()
Предыдущий раздел: Описание API системной библиотеки