.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu) .\" Modified 2001-04-01 by aeb .\" Modified 2003-07-23 by aeb .\" .\" Japanese Version Copyright (c) 1997 YOSHINO Takashi .\" all rights reserved. .\" Translated Mon Jan 20 18:47:50 JST 1997 .\" by YOSHINO Takashi .\" Updated Sat May 19 JST 2001 by Kentaro Shirakata .\" Updated Mon Sep 1 JST 2003 by Kentaro Shirakata .\" Updated 2007-05-04, Akihiro MOTOKI , LDP v2.44 .\" .TH USLEEP 3 2010-12-03 "" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O usleep \- suspend execution for interval of microseconds usleep \- マイクロ秒単位で実行を延期する .\"O .SH SYNOPSIS .SH 書式 .nf .B "#include " .sp .BI "int usleep(useconds_t " usec ); .fi .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR usleep (): .ad l .RS 4 .PD 0 .TP 4 .\"O Since glibc 2.12: glibc 2.12 以降: .nf _BSD_SOURCE || (_XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) && !(_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700) .TP 4 .fi .\"O Before glibc 2.12: glibc 2.12 より前: _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .PD .RE .ad b .\"O .SH DESCRIPTION .SH 説明 .\"O The .\"O .BR usleep () .\"O function suspends execution of the calling thread for .\"O (at least) \fIusec\fP microseconds. .\"O The sleep may be lengthened slightly .\"O by any system activity or by the time spent processing the call or by the .\"O granularity of system timers. .BR usleep () 関数は (少なくとも) \fIusec\fPマイクロ秒の間、 呼び出し元スレッドの実行を延期する。 システムの動作状況や呼び出しによる時間の消費やシステムタイマの粒度によって、 停止時間は設定した値よりも少し延ばされるかもしれない。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O 0 on success, \-1 on error. 成功すると 0、エラーの場合 \-1 を返す。 .\"O .SH ERRORS .SH エラー .TP .B EINTR .\"O Interrupted by a signal; see .\"O .BR signal (7). シグナルによって中断された。 .BR signal (7) 参照。 .TP .B EINVAL .\"O \fIusec\fP is not smaller than 1000000. .\"O (On systems where that is considered an error.) \fIusec\fP が 1000000 以上だった。 (これをエラーとみなすシステムのみ) .\"O .SH "CONFORMING TO" .SH 準拠 4.3BSD, POSIX.1-2001. .\"O POSIX.1-2001 declares this function obsolete; use .\"O .BR nanosleep (2) .\"O instead. POSIX.1-2001 では、この関数は過去のものと宣言されている。 代わりに .BR nanosleep (2) を使うこと。 .\"O POSIX.1-2008 removes the specification of .\"O .BR usleep (). POSIX.1-2008 では、 .BR usleep () の規定が削除されている。 .\"O On the original BSD implementation, .\"O and in glibc before version 2.2.2, the return type of this function is .\"O .IR void . .\"O The POSIX version returns .\"O .IR int , .\"O and this is also the prototype used since glibc 2.2.2. もともとの BSD の実装や、バージョン 2.2.2 より前の glibc では、 この関数の返り値の型は .I void である。 POSIX 版は .I int を返し、このプロトタイプは glibc 2.2.2 以降で使用されている。 .\"O Only the .\"O .B EINVAL .\"O error return is documented by SUSv2 and POSIX.1-2001. エラーとして .B EINVAL を返すというのは SUSv2 と POSIX.1-2001 でのみ文書化されている。 .\"O .SH NOTES .SH 注意 .\"O The type .\"O .I useconds_t .\"O is an unsigned integer type capable of holding integers .\"O in the range [0,1000000]. .\"O Programs will be more portable .\"O if they never mention this type explicitly. .\"O Use .I useconds_t 型は [0,1000000] の範囲の整数を扱うことができる 符号なし整数型である。 明示的にこの型を使わないことでプログラムの移植性がより高まる。 以下のように使うこと。 .in +4n .nf .sp #include \&... unsigned int usecs; \&... usleep(usecs); .fi .in .LP .\"O The interaction of this function with the .\"O .B SIGALRM .\"O signal, and with other timer functions such as .\"O .BR alarm (2), .\"O .BR sleep (3), .\"O .BR nanosleep (2), .\"O .BR setitimer (2), .\"O .BR timer_create (2), .\"O .BR timer_delete (2), .\"O .BR timer_getoverrun (2), .\"O .BR timer_gettime (2), .\"O .BR timer_settime (2), .\"O .BR ualarm (3) .\"O is unspecified. この関数と、 .B SIGALRM シグナルあるいは .BR alarm (2), .BR sleep (3), .BR nanosleep (2), .BR setitimer (2), .BR timer_create (2), .BR timer_delete (2), .BR timer_getoverrun (2), .BR timer_gettime (2), .BR timer_settime (2), .BR ualarm (3) といったその他のタイマー関数を同時に使った場合の動作は未定義である。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR alarm (2), .BR getitimer (2), .BR nanosleep (2), .BR select (2), .BR setitimer (2), .BR sleep (3), .BR ualarm (3), .BR time (7)