From 79f88e738b3623129ce0ee77334aa86da0f3395d Mon Sep 17 00:00:00 2001 From: Visa Hankala Date: Thu, 22 Apr 2021 15:30:13 +0000 Subject: kqueue: Make timer re-addition reset existing timer When an existing EVFILT_TIMER filter is re-added, cancel the existing timer and any pending event, and restart the timer using the new timeout period. This makes the new timeout period take effect immediately and matches the behaviour of FreeBSD. Previously, the new setting was applied only after the existing timer expired. The timer rescheduling is done by using an f_modify callback. The reading of timer events is moved from f_event to f_process. f_event of timer_filtops becomes redundant. Unlike most other event sources, timers activate knotes directly without using a klist and knote(9). OK mpi@ --- lib/libc/sys/kqueue.2 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index 3f4ccee24f6..08cef8fdc1f 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: kqueue.2,v 1.43 2020/11/14 10:16:15 jmc Exp $ +.\" $OpenBSD: kqueue.2,v 1.44 2021/04/22 15:30:12 visa Exp $ .\" .\" Copyright (c) 2000 Jonathan Lemon .\" All rights reserved. @@ -26,7 +26,7 @@ .\" .\" $FreeBSD: src/lib/libc/sys/kqueue.2,v 1.18 2001/02/14 08:48:35 guido Exp $ .\" -.Dd $Mdocdate: November 14 2020 $ +.Dd $Mdocdate: April 22 2021 $ .Dt KQUEUE 2 .Os .Sh NAME @@ -468,6 +468,11 @@ contains the number of times the timeout has expired since the last call to This filter automatically sets the .Dv EV_CLEAR flag internally. +.Pp +If an existing timer is re-added, the existing timer and related pending events +will be cancelled. +The timer will be re-started using the timeout period +.Fa data . .It Dv EVFILT_DEVICE Takes a descriptor as the identifier and the events to watch for in .Fa fflags , -- cgit v1.2.3