summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/sleep.3
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-08-12 16:46:05 +0000
committerache <ache@FreeBSD.org>1997-08-12 16:46:05 +0000
commit9fc764805ce0599c315781815fc0a3311fa00cb0 (patch)
treec456a5915cf402174abfdb8478fd05f4b609d56a /lib/libc/gen/sleep.3
parent901a0bfcc8d0a286788f0a704bc616a9587a1056 (diff)
downloadFreeBSD-src-9fc764805ce0599c315781815fc0a3311fa00cb0.zip
FreeBSD-src-9fc764805ce0599c315781815fc0a3311fa00cb0.tar.gz
Change to reflect -current sleep implementation reality
Diffstat (limited to 'lib/libc/gen/sleep.3')
-rw-r--r--lib/libc/gen/sleep.341
1 files changed, 13 insertions, 28 deletions
diff --git a/lib/libc/gen/sleep.3 b/lib/libc/gen/sleep.3
index f488a0b..ab7e6f0 100644
--- a/lib/libc/gen/sleep.3
+++ b/lib/libc/gen/sleep.3
@@ -52,25 +52,23 @@ of time.
System activity or time spent in processing the
call may lengthen the sleep by a second.
.Pp
-If a timer is already running on the process its state is saved.
+If a timer is already running on the process its state is unaltered by
+this sleep implementation.
If the value
.Fa seconds
-is more than or equal to the remaining clock time for the saved timer,
+is more than or equal to the remaining clock time for the running timer,
the sleep time is set to
the remaining clock time.
-The state of the previous timer
-is restored after
-.Fa seconds
-has passed.
.Pp
This function is implemented using
-.Xr setitimer 2 ;
-it requires eight system calls each time it is invoked.
-A similar but less compatible function can be obtained with a single
-.Xr select 2 ;
-such a function would not restart after signals, but would not interfere
-with other uses of
-.Xr setitimer 2 .
+.Xr signanosleep 2
+by pausing for
+.Fa seconds
+of time or until any signal occurse.
+For compatibility reasons during
+.Fn sleep
+call SIGALRM handler is temporary set to the
+function which does nothing but returns.
.Sh RETURN VALUES
The
.Fn sleep
@@ -81,22 +79,9 @@ needed to be passed to a subsequent sleep to complete the necessary delay.
repeatedly until it returns zero may busy-wait until a timer
is available.
.Sh SEE ALSO
-.Xr setitimer 2 ,
-.Xr sigpause 2 ,
+.Xr signal 3 ,
+.Xr signanosleep 2 ,
.Xr usleep 3
-.Sh CAVEAT
-In practice the
-.Tn FreeBSD
-implementation will not be interrupted: it will
-always return the original argument or zero. Code that depends on
-sleep being interrupted (using it as a timed pause, for example) needs
-to be recoded to use
-.Xr select 2
-or some other delay mechanism. Code that
-calls
-.Fn sleep
-repeatedly until it returns zero may busy-wait until a timer
-is available.
.Sh HISTORY
A
.Fn sleep
OpenPOWER on IntegriCloud