Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sleep(3) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

alarm

pause

sigaction, sigvec, signal



SLEEP(3,L)                  AIX Technical Reference                  SLEEP(3,L)



-------------------------------------------------------------------------------
sleep



PURPOSE

Suspends execution of the current process for an interval of time.

LIBRARY

Standard C Library (libc.a)

SYNTAX

unsigned int sleep (seconds)
unsigned int seconds;

DESCRIPTION

The sleep subroutine causes the current process to suspend execution for the
number of seconds specified by the seconds parameter.  The sleep routine sets
an alarm and pauses until that alarm or some other signal occurs.

The actual sleep time of the process may be either shorter or longer than the
requested sleep time.  The sleep time may be shorter because:

  o Wakeups occur on the second at fixed one-second intervals according to an
    internal clock.

  o Any caught signal terminates the sleep following execution of that signal's
    catching routine.

The sleep time may be longer than the requested sleep time due to the
scheduling of other activities in the system.

The value returned by the sleep subroutine is the requested sleep time minus
the time actually slept.

The process calling the sleep subroutine may set an alarm prior to calling the
sleep subroutine.

If a previous alarm has been set, and the sleep subroutine's sleep time exceeds
the process's previously set alarm time, the process only sleeps until the time
specified by the previously set alarm and the calling process's alarm catch
routine is executed just before the sleep subroutine returns.

If a previous alarm has been set, and the sleep subroutine's sleep time is less
than the process's previously set alarm time, the current process is suspended
from execution for the number of seconds specified by the sleep subroutine.
The previously set alarm is reset to go off at the same time it would have
without the sleep subroutines intervention.



Processed November 7, 1990        SLEEP(3,L)                                  1





SLEEP(3,L)                  AIX Technical Reference                  SLEEP(3,L)




Warning:  The results are undefined if, while it is sleeping, the calling
program issues any other alarm or sleep calls.  This can happen if a signal
arrives in the interim and the signal handler calls alarm or sleep.

ERROR CONDITIONS

The sleep subroutine is always successful and no return value is reserved to
indicate an error.

RELATED INFORMATION

In this book:  "alarm," "pause," and "sigaction, sigvec, signal."










































Processed November 7, 1990        SLEEP(3,L)                                  2



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