mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +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.
This commit is contained in:
parent
e127ba0041
commit
b9e3cd5d2a
@ -152,3 +152,13 @@ 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*
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user