mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Add isc_timer_running() function to check status of timer
In the next commit, we need to know whether the timer has been started
or stopped. Add isc_timer_running() function that returns true if the
timer has been started.
(cherry picked from commit b9e3cd5d2a
)
This commit is contained in:
@@ -156,4 +156,14 @@ isc_timer_destroy(isc_timer_t **timerp);
|
||||
*\li *timerp is NULL.
|
||||
*/
|
||||
|
||||
bool
|
||||
isc_timer_running(isc_timer_t *timer);
|
||||
/*%<
|
||||
* Return true if the timer has been started.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'timer' is a valid timer*
|
||||
*/
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/async.h>
|
||||
#include <isc/atomic.h>
|
||||
#include <isc/condition.h>
|
||||
#include <isc/heap.h>
|
||||
#include <isc/job.h>
|
||||
@@ -196,3 +197,10 @@ isc_timer_async_destroy(isc_timer_t **timerp) {
|
||||
isc_timer_stop(timer);
|
||||
isc_async_run(timer->loop, timer_destroy, timer);
|
||||
}
|
||||
|
||||
bool
|
||||
isc_timer_running(isc_timer_t *timer) {
|
||||
REQUIRE(VALID_TIMER(timer));
|
||||
|
||||
return atomic_load_acquire(&timer->running);
|
||||
}
|
||||
|
Reference in New Issue
Block a user