Scroll to navigation

SLEEP(3) Linux Programmer's Manual SLEEP(3)

名前

sleep - 指定の秒数の間だけ休止する

書式

#include <unistd.h>
unsigned int sleep(unsigned int seconds);

説明

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.

返り値

要求された時間が過ぎた場合はゼロを返す。 呼び出しがシグナルハンドラーに割り込まれた場合は、 休止の残り時間を返す。

属性

この節で使用されている用語の説明については、 attributes(7) を参照。

インターフェース 属性
sleep() Thread safety MT-Unsafe sig:SIGCHLD/linux

準拠

POSIX.1-2001, POSIX.1-2008.

注意

On Linux, sleep() is implemented via nanosleep(2). See the nanosleep(2) man page for a discussion of the clock used.

Portability notes

On some systems, sleep() may be implemented using alarm(2) and SIGALRM (POSIX.1 permits this); mixing calls to alarm(2) and sleep() is a bad idea.

休止中にシグナルハンドラーから longjmp(3) を使用することや SIGALRM のハンドリングを変更することは、定義されていない結果を生む。

関連項目


sleep(1), alarm(2), nanosleep(2), signal(2), signal(7)

この文書について

この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。

2017-09-15 GNU