diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-22 21:59:14 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-22 21:59:14 +0200 |
commit | 9295a00a976df83d2c35a6dc56ceb35c05f692dd (patch) | |
tree | ce5c72b18357400c0472960605dd12355107f7cc /ptimer.h | |
parent | 3d7ae10a541629727844163f7d64507baedd6c78 (diff) |
Fixup server connection timeouts
Diffstat (limited to 'ptimer.h')
-rw-r--r-- | ptimer.h | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -2,16 +2,24 @@ #define fooptimerhfoo struct ptimer_task { - /* to be set by caller */ unsigned interval; unsigned times; void (*cb)(struct ptimer_task *); - - /* internal */ + bool active; unsigned remain; struct list_head list; }; +static inline void +ptask_init(struct ptimer_task *ptask, unsigned interval, + unsigned times, void(*cb)(struct ptimer_task *)) +{ + ptask->interval = interval; + ptask->times = times; + ptask->cb = cb; + ptask->active = false; +} + void ptimer_del_task(struct ptimer_task *ptask); void ptimer_add_task(struct ptimer_task *ptask); |