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.
*
*\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*
+ */
#include <stdbool.h>
#include <isc/async.h>
+#include <isc/atomic.h>
#include <isc/condition.h>
#include <isc/heap.h>
#include <isc/job.h>
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);
+}