Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


sleep() — suspend execution for interval


#include <unistd.h>

unsigned int sleep(unsigned int seconds);


sleep() suspends the current process from execution for the number of seconds specified by the argument.

Actual suspension time can be less than that requested for two reasons:

  • Scheduled wakeups occur at fixed 1 second intervals (on the second, according to an internal clock), and

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

Suspension time can be an arbitrary amount longer than requested due to the scheduling of other activity in the system. The value returned by sleep() is 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.

seconds must be less than 2^31.


If a SIGALRM is generated for a multithreaded process, it may not be delivered to a thread currently in sleep(). See the sigwait(2) manpage for details.


sleep(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.