Expose internal timer_purge() as isc_timer_purge()

This function is used in a unit test to check for data races.
This commit is contained in:
Aram Sargsyan 2024-04-05 16:44:04 +00:00
parent 5ac515de1a
commit c7b15f1f5a
2 changed files with 24 additions and 0 deletions

View 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);
/*%<

View 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;