COHERENT manpages

This page displays the COHERENT manpage for sleep() [Suspend execution for interval].

List of available manpages
Index


sleep() -- General Function (libc)

Suspend execution for interval
#include <unistd.h>
sleep(seconds)
unsigned seconds;

sleep() suspends execution for not less than seconds.

Example

The following example demonstrates how to use sleep():

#include <unistd.h>
main()
{
    printf("Waiting for Godot ...\n");

    for ( ; ; ) {
        sleep(5);   /* sleep for five seconds */
        printf("... still waiting ...\n");
    }
}

See Also

libc,
nap(),
unistd.h
POSIX Standard, §3.4.3

Notes

To make  a program  sleep for  less than one  second, use the  system calls
nap() or poll(). For an example, see the Lexicon article for poll().