mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Add accessor for inspecting timer callbacks.
This commit is contained in:
parent
ca4a0ae0b1
commit
e6facbfe7a
@ -254,6 +254,20 @@ timer_set_cb(tor_timer_t *t, timer_cb_fn_t cb, void *arg)
|
||||
t->callback.arg = 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().
|
||||
|
@ -13,6 +13,8 @@ typedef void (*timer_cb_fn_t)(tor_timer_t *, void *,
|
||||
const struct monotime_t *);
|
||||
tor_timer_t *timer_new(timer_cb_fn_t cb, void *arg);
|
||||
void timer_set_cb(tor_timer_t *t, timer_cb_fn_t cb, void *arg);
|
||||
void timer_get_cb(const tor_timer_t *t,
|
||||
timer_cb_fn_t *cb_out, void **arg_out);
|
||||
void timer_schedule(tor_timer_t *t, const struct timeval *delay);
|
||||
void timer_disable(tor_timer_t *t);
|
||||
void timer_free(tor_timer_t *t);
|
||||
|
Loading…
Reference in New Issue
Block a user