sleep

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

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

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#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 safetyMT-Unsafe sig:SIGCHLD/linux
 

バージョン

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

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.  

標準規格

POSIX.1-2008.  

歴史

POSIX.1-2001.  

警告

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

関連項目


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


 

Index

名前
ライブラリ
書式
説明
返り値
属性
バージョン
標準規格
歴史
警告
関連項目

This document was created by man2html, using the manual pages.