![]() |
![]() |
![]() |
Busy-wait without blocking for a period of time
#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. They should be used only to delay for times less than a few milliseconds.
The first time nanospin_ns() is called, the C library invokes nanospin_calibrate(), if the user hasn't invoked it directly first.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Read the Caveats |
Signal handler | Yes |
Thread | Yes |
Busy-waiting should only be used when absolutely necessary for accessing hardware.
This function isn't safe to call 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()
![]() |
![]() |
![]() |