summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Knudsen <mk@cvs.openbsd.org>2006-09-19 21:43:14 +0000
committerMichael Knudsen <mk@cvs.openbsd.org>2006-09-19 21:43:14 +0000
commit7a58833b9fd00e81a35f678f650641ecad57a708 (patch)
tree14248ba45269782284aecc6feebf34b9bb97c8e7
parent8dbc6c4d38e35867029c741d8be7f569b79b6462 (diff)
A bit of microoptimisation that doesn't hurt readability: Don't do
timeout_del() if we're going to timeout_add() in the next block. ok dlg (a while ago), markus
-rw-r--r--sys/kern/kern_watchdog.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/kern_watchdog.c b/sys/kern/kern_watchdog.c
index ef620604f0f..b58d1fec115 100644
--- a/sys/kern/kern_watchdog.c
+++ b/sys/kern/kern_watchdog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_watchdog.c,v 1.5 2006/07/12 21:31:23 mk Exp $ */
+/* $OpenBSD: kern_watchdog.c,v 1.6 2006/09/19 21:43:13 mk Exp $ */
/*
* Copyright (c) 2003 Markus Friedl. All rights reserved.
@@ -99,10 +99,11 @@ sysctl_wdog(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (EINVAL);
}
- timeout_del(&wdog_timeout);
if (wdog_auto && wdog_period > 0) {
(void) (*wdog_ctl_cb)(wdog_ctl_cb_arg, wdog_period);
timeout_add(&wdog_timeout, wdog_period * hz / 2);
- }
+ } else
+ timeout_del(&wdog_timeout);
+
return (error);
}