diff options
Diffstat (limited to 'man2/nanosleep.2')
-rw-r--r-- | man2/nanosleep.2 | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/man2/nanosleep.2 b/man2/nanosleep.2 index 4693dc8..61242ea 100644 --- a/man2/nanosleep.2 +++ b/man2/nanosleep.2 @@ -12,7 +12,7 @@ .\" NOTES: describe case where clock_nanosleep() can be preferable. .\" NOTES: describe CLOCK_REALTIME versus CLOCK_NANOSLEEP .\" Replace crufty discussion of HZ with a pointer to time(7). -.TH nanosleep 2 2023-03-30 "Linux man-pages 6.05.01" +.TH nanosleep 2 2024-03-03 "Linux man-pages 6.7" .SH NAME nanosleep \- high-resolution sleep .SH LIBRARY @@ -21,16 +21,16 @@ Standard C library .SH SYNOPSIS .nf .B #include <time.h> -.PP -.BI "int nanosleep(const struct timespec *" req , +.P +.BI "int nanosleep(const struct timespec *" duration , .BI " struct timespec *_Nullable " rem ); .fi -.PP +.P .RS -4 Feature Test Macro Requirements for glibc (see .BR feature_test_macros (7)): .RE -.PP +.P .BR nanosleep (): .nf _POSIX_C_SOURCE >= 199309L @@ -39,11 +39,11 @@ Feature Test Macro Requirements for glibc (see .BR nanosleep () suspends the execution of the calling thread until either at least the time specified in -.I *req +.I *duration has elapsed, or the delivery of a signal that triggers the invocation of a handler in the calling thread or that terminates the process. -.PP +.P If the call is interrupted by a signal handler, .BR nanosleep () returns \-1, sets @@ -60,14 +60,14 @@ The value of can then be used to call .BR nanosleep () again and complete the specified pause (but see NOTES). -.PP +.P The .BR timespec (3) structure is used to specify intervals of time with nanosecond precision. -.PP +.P The value of the nanoseconds field must be in the range [0, 999999999]. -.PP +.P Compared to .BR sleep (3) and @@ -80,7 +80,7 @@ does not interact with signals; and it makes the task of resuming a sleep that has been interrupted by a signal handler easier. .SH RETURN VALUE -On successfully sleeping for the requested interval, +On successfully sleeping for the requested duration, .BR nanosleep () returns 0. If the call is interrupted by a signal handler or encounters an error, @@ -128,7 +128,7 @@ says that discontinuous changes in should not affect .BR nanosleep (): .RS -.PP +.P Setting the value of the .B CLOCK_REALTIME clock via @@ -138,14 +138,15 @@ have no effect on threads that are blocked waiting for a relative time service based upon this clock, including the .BR nanosleep () function; ... -Consequently, these time services shall expire when the requested relative -interval elapses, independently of the new or old value of the clock. +Consequently, +these time services shall expire when the requested duration elapses, +independently of the new or old value of the clock. .RE .SH STANDARDS POSIX.1-2008. .SH HISTORY POSIX.1-2001. -.PP +.P In order to support applications requiring much more precise pauses (e.g., in order to control some time-critical hardware), .BR nanosleep () @@ -158,14 +159,14 @@ or This special extension was removed in Linux 2.5.39, and is thus not available in Linux 2.6.0 and later kernels. .SH NOTES -If the interval specified in -.I req +If the +.I duration is not an exact multiple of the granularity underlying clock (see .BR time (7)), then the interval will be rounded up to the next multiple. Furthermore, after the sleep completes, there may still be a delay before the CPU becomes free to once again execute the calling thread. -.PP +.P The fact that .BR nanosleep () sleeps for a relative interval can be problematic if the call @@ -194,7 +195,7 @@ To avoid such problems, use with the .B TIMER_ABSTIME flag to sleep to an absolute deadline. -.PP +.P In Linux 2.4, if .BR nanosleep () is stopped by a signal (e.g., |