POSIX Threads for Windows – REFERENCE - Pthreads-w32

Reference Index

Table of Contents


pthread_delay_np – suspend the thread for a specified period


#include <pthread.h>

int pthread_delay_np (const struct timespec *interval);


pthread_delay_np 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 can be due to system load, thread priorities, and system timer granularity.

Specifying an interval of zero (0) seconds and zero (0) nanoseconds is allowed and can be used to force the thread to give up the processor or to deliver a pending cancellation request.


pthread_delay_np is a cancellation point.

Return Value

If an error condition occurs, pthread_delay_np returns an integer value indicating the type of error.


The pthread_delay_np function returns the following error code on error:


The value specified by interval is invalid.


Ross Johnson for use with Pthreads-w32.

Table of Contents