Index | Thread | Search

From:
Bjorn Ketelaars <bket@openbsd.org>
Subject:
[PATCH 2/4] evtimer_del(): remove redundant pending check in tcpbench
To:
tech@openbsd.org
Date:
Fri, 16 Oct 2026 14:33:19 +0200

Download raw body.

Thread
event(3) says event_del() has no effect if an event “has already
executed or has never been added”. Since evtimer_del() is an
abbreviation for the same event API, tcpbench can delete its slice timer
directly when disabling it, without first checking evtimer_pending().

This is a mechanical cleanup; it does not change when the timer is
scheduled.

Comments/OK?


Index: usr.bin/tcpbench/tcpbench.c
===================================================================
RCS file: /cvs/src/usr.bin/tcpbench/tcpbench.c,v
diff -u -p -r1.79 tcpbench.c
--- usr.bin/tcpbench/tcpbench.c	12 Oct 2026 14:40:52 -0000	1.79
+++ usr.bin/tcpbench/tcpbench.c	16 Oct 2026 12:11:01 -0000
@@ -266,7 +266,7 @@ set_slice_timer(int on)
 		tv.tv_usec = (ptb->rflag % 1000) * 1000;
 
 		evtimer_add(&mainstats.timer, &tv);
-	} else if (evtimer_pending(&mainstats.timer, NULL))
+	} else
 		evtimer_del(&mainstats.timer);
 }