SLEEP

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
 

NAME

sleep - suspend process execution for interval of seconds  

SYNOPSIS

Fd #include <unistd.h> Ft int Fn sleep u_int seconds  

DESCRIPTION

The Fn sleep function suspends execution of the calling process for Fa seconds of time. System activity or time spent in processing the call may lengthen the sleep by a second.

If a timer is already running on the process its state is saved. If the value Fa seconds is more than or equal to the remaining clock time for the saved timer, the sleep time is set to the remaining clock time. The state of the previous timer is restored after Fa seconds has passed.

This function is implemented using setitimer(2); it requires eight system calls each time it is invoked. A similar but less compatible function can be obtained with a single select(2); such a function would not restart after signals, but would not interfere with other uses of setitimer.  

RETURN VALUES

 

SEE ALSO

setitimer(2), sigpause(2), usleep(3)  

HISTORY

A Fn sleep function appeared in AT&T System v7 .


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
SEE ALSO
HISTORY

This document was created by man2html, using the manual pages.
Time: 06:42:18 GMT, May 19, 2025