[Previous] [Contents] [Next]

nanospin_ns()

Busy-wait without blocking for a period of time

Synopsis:

#include <time.h>

int nanospin_ns( unsigned long nsec );

Library:

libc

Description:

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.

Returns:

0
Success.
-1
An error occurred; errno is set.

Errors:

E2BIG
The delay specified by nsec is greater than 500 milliseconds.
ENOSYS
This system's startup-* program didn't initialize the timing information necessary to use nanospin_ns().

Classification:

QNX 6

Safety:
Cancellation point No
Interrupt handler Read the Caveats
Signal handler Yes
Thread Yes

Caveats:

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.

See also:

nanosleep(), nanospin(), nanospin_calibrate(), nanospin_count(), nanospin_ns_to_count(), sched_yield(), sleep()


[Previous] [Contents] [Next]