diff options
author | David Goulet <dgoulet@torproject.org> | 2018-04-17 09:31:50 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-04-23 10:57:28 -0400 |
commit | a4fcdc5decfe60bbd95aee2e5586e90c40b73225 (patch) | |
tree | 851d54d5947c7b9c91df5f0da7e063ceca641199 /src/or/periodic.h | |
parent | ed89bb32535fbf354b406a36f3176380a4e226bf (diff) | |
download | tor-a4fcdc5decfe60bbd95aee2e5586e90c40b73225.tar.gz tor-a4fcdc5decfe60bbd95aee2e5586e90c40b73225.zip |
main: Launch periodic events by roles
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/periodic.h')
-rw-r--r-- | src/or/periodic.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/periodic.h b/src/or/periodic.h index 4544ae2763..1b346a1cc8 100644 --- a/src/or/periodic.h +++ b/src/or/periodic.h @@ -49,11 +49,21 @@ typedef struct periodic_event_item_t { /* Bitmask of roles define above for which this event applies. */ uint32_t roles; + /* Indicate that this event has been enabled that is scheduled. */ + unsigned int enabled : 1; } periodic_event_item_t; /** events will get their interval from first execution */ -#define PERIODIC_EVENT(fn, r) { fn##_callback, 0, NULL, #fn, r } -#define END_OF_PERIODIC_EVENTS { NULL, 0, NULL, NULL, 0 } +#define PERIODIC_EVENT(fn, r) { fn##_callback, 0, NULL, #fn, r, 0 } +#define END_OF_PERIODIC_EVENTS { NULL, 0, NULL, NULL, 0, 0 } + +/* Return true iff the given event was setup before thus is enabled to be + * scheduled. */ +static inline int +periodic_event_is_enabled(const periodic_event_item_t *item) +{ + return item->enabled; +} void periodic_event_launch(periodic_event_item_t *event); void periodic_event_setup(periodic_event_item_t *event); |