]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Expose internal timer_purge() as isc_timer_purge()
authorAram Sargsyan <aram@isc.org>
Fri, 5 Apr 2024 16:44:04 +0000 (16:44 +0000)
committerAram Sargsyan <aram@isc.org>
Fri, 17 May 2024 10:49:57 +0000 (10:49 +0000)
This function is used in a unit test to check for data races.

lib/isc/include/isc/timer.h
lib/isc/timer.c

index 815cf42dbe32f997504a2ab21bf4e4fbe4ac1a7f..77b7507031bb41b7cb6b20780661d991ca97bfe1 100644 (file)
@@ -224,6 +224,21 @@ isc_timer_touch(isc_timer_t *timer);
  *\li  Unexpected error
  */
 
+void
+isc_timer_purge(isc_timer_t *timer);
+/*%<
+ * Purge timer.
+ *
+ * Requires:
+ *
+ *\li  'timer' points to a valid timer.
+ *
+ * Ensures:
+ *
+ *\li  Any events already posted by the timer are purged.
+ *
+ */
+
 void
 isc_timer_destroy(isc_timer_t **timerp);
 /*%<
index 40ae929ce8773b11a85e2daf629174dbb73fbb94..e4a1c4b2ccae60bc8b1a327f9016c3edde001843 100644 (file)
@@ -469,6 +469,15 @@ isc_timer_touch(isc_timer_t *timer) {
        return (result);
 }
 
+void
+isc_timer_purge(isc_timer_t *timer) {
+       REQUIRE(VALID_TIMER(timer));
+
+       LOCK(&timer->lock);
+       timer_purge(timer);
+       UNLOCK(&timer->lock);
+}
+
 void
 isc_timer_destroy(isc_timer_t **timerp) {
        isc_timer_t *timer = NULL;