0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 20:58:44 +00:00

Merge branch 'master' into int-new

This commit is contained in:
Ondrej Zajicek (work) 2017-05-18 14:28:03 +02:00
commit 5a9169e152

View File

@ -19,14 +19,14 @@ typedef struct timer {
resource r; resource r;
void (*hook)(struct timer *); void (*hook)(struct timer *);
void *data; void *data;
unsigned randomize; /* Amount of randomization */ uint randomize; /* Amount of randomization */
unsigned recurrent; /* Timer recurrence */ uint recurrent; /* Timer recurrence */
node n; /* Internal link */ node n; /* Internal link */
bird_clock_t expires; /* 0=inactive */ bird_clock_t expires; /* 0=inactive */
} timer; } timer;
timer *tm_new(pool *); timer *tm_new(pool *);
void tm_start(timer *, unsigned after); void tm_start(timer *, uint after);
void tm_stop(timer *); void tm_stop(timer *);
void tm_dump_all(void); void tm_dump_all(void);
@ -47,14 +47,14 @@ tm_remains(timer *t)
} }
static inline void static inline void
tm_start_max(timer *t, unsigned after) tm_start_max(timer *t, bird_clock_t after)
{ {
bird_clock_t rem = tm_remains(t); bird_clock_t rem = tm_remains(t);
tm_start(t, (rem > after) ? rem : after); tm_start(t, (rem > after) ? rem : after);
} }
static inline timer * static inline timer *
tm_new_set(pool *p, void (*hook)(struct timer *), void *data, unsigned rand, unsigned rec) tm_new_set(pool *p, void (*hook)(struct timer *), void *data, uint rand, uint rec)
{ {
timer *t = tm_new(p); timer *t = tm_new(p);
t->hook = hook; t->hook = hook;