summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2013-11-27 04:28:33 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2013-11-27 04:28:33 +0000
commitb948ce6d7fb9d00fc6d81440c298350a2bcf197a (patch)
treede3f35226c2c1b43e105958d6365605254144329 /share
parent4650bdbc69748bba813ff0be32c2bf32b4d6c1d7 (diff)
make timeout_add and its wrappers return whether the timeout was scheduled
in this call by returning 1, or a previous call by returning 0. this makes it easy to refcount the stuff we're scheduling a timeout for, and brings the api in line with what task_add(9) provides. ok mpi@ matthew@ mikeb@ guenther@
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/timeout.925
1 files changed, 14 insertions, 11 deletions
diff --git a/share/man/man9/timeout.9 b/share/man/man9/timeout.9
index a14c0a158be..fe80ea90683 100644
--- a/share/man/man9/timeout.9
+++ b/share/man/man9/timeout.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: timeout.9,v 1.32 2013/06/04 19:27:14 schwarze Exp $
+.\" $OpenBSD: timeout.9,v 1.33 2013/11/27 04:28:32 dlg Exp $
.\"
.\" Copyright (c) 2000 Artur Grabowski <art@openbsd.org>
.\" All rights reserved.
@@ -23,7 +23,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 4 2013 $
+.Dd $Mdocdate: November 27 2013 $
.Dt TIMEOUT 9
.Os
.Sh NAME
@@ -46,7 +46,7 @@
.In sys/timeout.h
.Ft void
.Fn "timeout_set" "struct timeout *to" "void (*fn)(void *)" "void *arg"
-.Ft void
+.Ft int
.Fn "timeout_add" "struct timeout *to" "int ticks"
.Ft int
.Fn "timeout_del" "struct timeout *to"
@@ -56,19 +56,19 @@
.Fn "timeout_initialized" "struct timeout *to"
.Ft int
.Fn "timeout_triggered" "struct timeout *to"
-.Ft void
+.Ft int
.Fn "timeout_add_tv" "struct timeout *to" "struct timeval *"
-.Ft void
+.Ft int
.Fn "timeout_add_ts" "struct timeout *to" "struct timespec *"
-.Ft void
+.Ft int
.Fn "timeout_add_bt" "struct timeout *to" "struct bintime *"
-.Ft void
+.Ft int
.Fn "timeout_add_sec" "struct timeout *to" "int sec"
-.Ft void
+.Ft int
.Fn "timeout_add_msec" "struct timeout *to" "int msec"
-.Ft void
+.Ft int
.Fn "timeout_add_usec" "struct timeout *to" "int usec"
-.Ft void
+.Ft int
.Fn "timeout_add_nsec" "struct timeout *to" "int nsec"
.Sh DESCRIPTION
The
@@ -133,6 +133,9 @@ and may not be used in calls to
.Fn timeout_set
until it has timed out or been removed with
.Fn timeout_del .
+If the timeout was not already scheduled by a previous call to
+.Fn timeout_add
+it will return 1, otherwise 0.
If the timeout in the
.Fa to
argument is already scheduled, the old execution time will be
@@ -146,7 +149,7 @@ If the timeout has already executed or has never been added
the call will have no effect.
If the timeout was actually removed by
.Fn timeout_del
-it will return 1.
+it will return 1, otherwise 0.
.Pp
The
.Fn timeout_pending