![]() |
![]() |
![]() |
Busy-wait without blocking for a period of time
#include <time.h> int nanospin( const struct timespec *when );
libc
The nanospin() function busy-waits for the amount of time specified in when without blocking the calling thread. The when argument is a duration, not an absolute time.
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() is called, the C library invokes nanospin_calibrate(), if the user hasn't already called it.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |
Busy-waiting should be used only when absolutely necessary for accessing hardware.
nanosleep(), nanospin_calibrate(), nanospin_count(), nanospin_ns(), nanospin_ns_to_count(), sched_yield(), sleep()
![]() |
![]() |
![]() |