summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormk <mk@openbsd.org>2006-09-19 21:43:13 +0000
committermk <mk@openbsd.org>2006-09-19 21:43:13 +0000
commit48c577acfde38a6be68d21c1365dd007e45efba6 (patch)
treeb8da0c8f884c0d8d8647ba7119ad59af2423fcad /sys
parentsort SAs by spi; ok hshoexer (diff)
downloadwireguard-openbsd-48c577acfde38a6be68d21c1365dd007e45efba6.tar.xz
wireguard-openbsd-48c577acfde38a6be68d21c1365dd007e45efba6.zip
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
Diffstat (limited to 'sys')
-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);
}