CINXE.COM
sleep
<html> <head> <title>sleep</title> <META NAME="KEYWORDS" CONTENT="sleep"> </head> <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#0000ff" ALINK="#0000ff" TEXT="#000000"> <center> <h1><b>sleep</b></h1></center> <PRE> <STRONG><A HREF="/man3/SLEEP">SLEEP(3)</A></STRONG> Linux Programmer's Manual <STRONG><A HREF="/man3/SLEEP">SLEEP(3)</A></STRONG> NAME sleep - sleep for a specified number of seconds SYNOPSIS #include <unistd.h> unsigned int sleep(unsigned int seconds); DESCRIPTION sleep() causes the calling thread to sleep either until the number of real-time seconds specified in seconds have elapsed or until a signal arrives which is not ignored. RETURN VALUE Zero if the requested time has elapsed, or the number of seconds left to sleep, if the call was interrupted by a signal handler. ATTRIBUTES For an explanation of the terms used in this section, see at- <STRONG><A HREF="/man7/tributes">tributes(7)</A></STRONG>. +----------+---------------+-----------------------------+ |Interface | Attribute | Value | +----------+---------------+-----------------------------+ |sleep() | Thread safety | MT-Unsafe sig:SIGCHLD/linux | +----------+---------------+-----------------------------+ CONFORMING TO POSIX.1-2001, POSIX.1-2008. NOTES On Linux, sleep() is implemented via <STRONG><A HREF="/man2/nanosleep">nanosleep(2)</A></STRONG>. See the <STRONG><A HREF="/man2/nanosleep">nanosleep(2)</A></STRONG> man page for a discussion of the clock used. Portability notes On some systems, sleep() may be implemented using <STRONG><A HREF="/man2/alarm">alarm(2)</A></STRONG> and SIGALRM (POSIX.1 permits this); mixing calls to <STRONG><A HREF="/man2/alarm">alarm(2)</A></STRONG> and sleep() is a bad idea. Using <STRONG><A HREF="/man3/longjmp">longjmp(3)</A></STRONG> from a signal handler or modifying the handling of SIGALRM while sleeping will cause undefined results. SEE ALSO <STRONG><A HREF="/man1/sleep">sleep(1)</A></STRONG>, <STRONG><A HREF="/man2/alarm">alarm(2)</A></STRONG>, <STRONG><A HREF="/man2/nanosleep">nanosleep(2)</A></STRONG>, <STRONG><A HREF="/man2/signal">signal(2)</A></STRONG>, <STRONG><A HREF="/man7/signal">signal(7)</A></STRONG> COLOPHON This page is part of release 5.05 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU 2017-09-15 <STRONG><A HREF="/man3/SLEEP">SLEEP(3)</A></STRONG></PRE> <center> <h6>Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2025 <a href="http://www.he.net">Hurricane Electric</a>. All Rights Reserved.</h6></center> </body> </html>