mirror of https://github.com/mkerrisk/man-pages
parent
e2ba4f8ea7
commit
5a7f195c23
|
@ -28,18 +28,12 @@
|
|||
.\" Modified 2001-04-01 by aeb
|
||||
.\" Modified 2003-07-23 by aeb
|
||||
.\"
|
||||
.TH USLEEP 3 2003-07-23 "" "Linux Programmer's Manual"
|
||||
.TH USLEEP 3 2007-02-01 "" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
usleep \- suspend execution for microsecond intervals
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
/* BSD version */
|
||||
.B "#include <unistd.h>"
|
||||
.sp
|
||||
.BI "void usleep(unsigned long " usec );
|
||||
.sp
|
||||
/* SUSv2 version */
|
||||
.B "#define _XOPEN_SOURCE 500"
|
||||
.B "#define _XOPEN_SOURCE 500 /* Or: #define _BSD_SOURCE */"
|
||||
.br
|
||||
.B "#include <unistd.h>"
|
||||
.sp
|
||||
|
@ -51,7 +45,7 @@ The \fBusleep\fP() function suspends execution of the calling process for
|
|||
by any system activity or by the time spent processing the call or by the
|
||||
granularity of system timers.
|
||||
.SH "RETURN VALUE"
|
||||
None (BSD). Or: 0 on success, \-1 on error (SUSv2).
|
||||
0 on success, \-1 on error.
|
||||
.SH ERRORS
|
||||
.TP
|
||||
EINTR
|
||||
|
@ -62,8 +56,17 @@ EINVAL
|
|||
(On systems where that is considered an error.)
|
||||
.SH "CONFORMING TO"
|
||||
4.3BSD, POSIX.1-2001.
|
||||
The SUSv2 version returns int, and this is also the prototype
|
||||
used by glibc 2.2.2.
|
||||
POSIX.1-2001 declares this function obsolete; use
|
||||
.BR nanosleep (2)
|
||||
instead.
|
||||
|
||||
On the original BSD implementation,
|
||||
and in glibc before version 2.2.2, the return type of this function is
|
||||
.IR void .
|
||||
The POSIX version returns
|
||||
.IR int ,
|
||||
and this is also the prototype used since glibc 2.2.2.
|
||||
|
||||
Only the EINVAL error return is documented by SUSv2.
|
||||
.SH NOTES
|
||||
The type
|
||||
|
@ -77,19 +80,11 @@ if they never mention this type explicitly. Use
|
|||
.sp
|
||||
#include <unistd.h>
|
||||
\&...
|
||||
unsigned int usecs;
|
||||
\&...
|
||||
usleep(usecs);
|
||||
.sp
|
||||
unsigned int usecs;
|
||||
\&.
|
||||
usleep(usecs);
|
||||
.fi
|
||||
.RE
|
||||
This type is defined by
|
||||
.I <sys/types.h>
|
||||
included by
|
||||
.I <unistd.h>
|
||||
but glibc defines it only when _XOPEN_SOURCE has a value not less than 500,
|
||||
or both _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED are defined.
|
||||
.\" useconds_t also gives problems on HP-UX 10.
|
||||
.LP
|
||||
The interaction of this function with the SIGALRM signal, and with
|
||||
other timer functions such as
|
||||
|
@ -104,17 +99,13 @@ other timer functions such as
|
|||
.BR timer_settime (),
|
||||
.BR ualarm ()
|
||||
is unspecified.
|
||||
.LP
|
||||
This function is obsolete. Use
|
||||
.BR nanosleep (2)
|
||||
or
|
||||
.BR setitimer (2)
|
||||
instead.
|
||||
.SH "SEE ALSO"
|
||||
.BR alarm (2),
|
||||
.BR getitimer (2),
|
||||
.BR nanosleep (2),
|
||||
.BR select (2),
|
||||
.BR setitimer (2),
|
||||
.BR ualarm (3),
|
||||
.BR sleep (3),
|
||||
.BR feature_test_macros (7)
|
||||
.BR feature_test_macros (7),
|
||||
.BR time (7)
|
||||
|
|
Loading…
Reference in New Issue