Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

setitimer(2)

sigpause(2)

usleep(3)

SLEEP(3V)  —  SYSTEM V LIBRARY

NAME

sleep − suspend execution for interval

SYNOPSIS

unsigned sleep(seconds)
unsigned seconds;

DESCRIPTION

sleep() suspends the current process from execution for the number of seconds specified by the argument.  The actual suspension time may be less than that requested for two reasons: (1) because scheduled wakeups occur at fixed 1-second intervals and (2) because any caught signal will terminate the sleep() following execution of that signal’s catching routine.  Also, the suspension time may be an arbitrary amount longer than requested because of other activity in the system.  The value returned by sleep() will be the “unslept” amount (the requested time minus the time actually slept) in case the caller had an alarm set to go off earlier than the end of the requested sleep() time, or premature arousal due to another caught signal. 

sleep() is implemented by setting an interval timer and pausing until it expires.  The previous state of this timer is saved and restored.  If the sleep time exceeds the time to the expiration of the previous value of the timer, the process sleeps only until the timer would have expired, and the signal which occurs with the expiration of the timer is sent one second later. 

SEE ALSO

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

Sun Release 4.0  —  Last change: 6 October 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026