aboutsummaryrefslogtreecommitdiff
path: root/src/common/timers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-12-02 12:15:07 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-02 12:15:07 -0500
commite6facbfe7abc50de374300ecd83873ead65b4b04 (patch)
treeb4a56fa0d25e64effb33eaaed4d065ac7bc0d926 /src/common/timers.c
parentca4a0ae0b18c2f3f14eb7a6243b52f5769216aa0 (diff)
downloadtor-e6facbfe7abc50de374300ecd83873ead65b4b04.tar.gz
tor-e6facbfe7abc50de374300ecd83873ead65b4b04.zip
Add accessor for inspecting timer callbacks.
Diffstat (limited to 'src/common/timers.c')
-rw-r--r--src/common/timers.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/timers.c b/src/common/timers.c
index 41b2008ac4..e1ad47b15b 100644
--- a/src/common/timers.c
+++ b/src/common/timers.c
@@ -255,6 +255,20 @@ timer_set_cb(tor_timer_t *t, timer_cb_fn_t cb, void *arg)
}
/**
+ * Set *<b>cb_out</b> (if provided) to this timer's callback function,
+ * and *<b>arg_out</b> (if provided) to this timer's callback argument.
+ */
+void
+timer_get_cb(const tor_timer_t *t,
+ timer_cb_fn_t *cb_out, void **arg_out)
+{
+ if (cb_out)
+ *cb_out = t->callback.cb;
+ if (arg_out)
+ *arg_out = t->callback.arg;
+}
+
+/**
* Schedule the timer t to fire at the current time plus a delay of
* <b>delay</b> microseconds. All times are relative to monotime_get().
*/