Causes a thread to delay execution.
Syntax
pthread_delay_np(
interval );
Argument Data Type Access
interval struct timespec read
C Binding
#include
int
pthread_delay_np (
const struct timespec *interval);
Arguments
- interval
- Number of seconds and nanoseconds to delay execution. The value
specified for each must be greater than or equal to zero.
Description
This routine causes a thread to delay execution for a specific
period of time. This period ends at the current time plus the
specified interval. The routine will not return before the end of
the period is reached, but may return an arbitrary amount of time
after the period has gone by. This is due to system load, thread
priorities, and system timer granularity.
Specifying an interval of 0 seconds and 0 nanoseconds is allowed
and can be used to force the thread to give up the processor or to
deliver a pending cancel.
The struct timespec structure contains the following two fields:
- tv_sec is an integer number of seconds.
- tv_nsec is an integer number of nanoseconds.
Return Values
If an error condition occurs, this routine returns an integer value
indicating the type of error. Possible return values are as follows:
Return Description
0 Successful completion.
[EINVAL] The value specified by interval is invalid.