Tor  0.4.7.0-alpha-dev
Macros | Typedefs | Functions
timers.h File Reference

Header for timers.c. More...

#include "orconfig.h"
#include "lib/testsupport/testsupport.h"

Go to the source code of this file.

Macros

#define timer_free(t)   FREE_AND_NULL(tor_timer_t, timer_free_, (t))
 

Typedefs

typedef void(* timer_cb_fn_t) (tor_timer_t *, void *, const struct monotime_t *)
 

Functions

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)
 
void timers_initialize (void)
 
void timers_shutdown (void)
 

Detailed Description

Header for timers.c.

Definition in file timers.h.

Function Documentation

◆ timer_disable()

void timer_disable ( tor_timer_t *  t)

Cancel the timer t if it is currently scheduled. (It's okay to call this on an unscheduled timer.

Definition at line 326 of file timers.c.

◆ timer_free_()

void timer_free_ ( tor_timer_t *  t)

Release all storage held by t, and unschedule it if was already scheduled.

Definition at line 263 of file timers.c.

◆ timer_get_cb()

void timer_get_cb ( const tor_timer_t *  t,
timer_cb_fn_t *  cb_out,
void **  arg_out 
)

Set *cb_out (if provided) to this timer's callback function, and *arg_out (if provided) to this timer's callback argument.

Definition at line 287 of file timers.c.

◆ timer_new()

tor_timer_t* timer_new ( timer_cb_fn_t  cb,
void *  arg 
)

Allocate and return a new timer, with given callback and argument.

Definition at line 250 of file timers.c.

◆ timer_schedule()

void timer_schedule ( tor_timer_t *  t,
const struct timeval tv 
)

Schedule the timer t to fire at the current time plus a delay of delay microseconds. All times are relative to monotime_get().

Definition at line 301 of file timers.c.

◆ timer_set_cb()

void timer_set_cb ( tor_timer_t *  t,
timer_cb_fn_t  cb,
void *  arg 
)

Change the callback and argument associated with a timer t.

Definition at line 276 of file timers.c.

◆ timers_initialize()

void timers_initialize ( void  )

Initialize the timers subsystem. Requires that libevent has already been initialized.

Definition at line 205 of file timers.c.

◆ timers_shutdown()

void timers_shutdown ( void  )

Release all storage held in the timers subsystem. Does not fire timers.

Definition at line 234 of file timers.c.

Referenced by tor_cleanup().