diff --git a/lib/isc/include/isc/timer.h b/lib/isc/include/isc/timer.h index 815cf42dbe..77b7507031 100644 --- a/lib/isc/include/isc/timer.h +++ b/lib/isc/include/isc/timer.h @@ -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); /*%< diff --git a/lib/isc/timer.c b/lib/isc/timer.c index 40ae929ce8..e4a1c4b2cc 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -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;