XROAD
xroad_timer.h
Go to the documentation of this file.
1 #pragma once
8 #include <stdbool.h>
9 #include "xroad_time.h"
10 #include "xroad_timer_ext.h"
11 #include "xroad_common_types.h"
12 #include "xroad_common_fwd.h"
13 
14 #ifdef __cplusplus
15 extern "C"
16 {
17 #endif
18 
22 typedef struct
23 {
24  void* ctx;
25  void (*on_timer)(void* ctx);
27 
35 
36 #ifndef __cplusplus
37 
44 #define xroad_timer_start(timer, interval) _Generic((interval), \
45  xroad_time_t: xroad_timer_start_tm, \
46  default: xroad_timer_start_int \
47  )(timer, interval)
48 
56 #define xroad_timer_start_repeat(timer, start, repeat) _Generic((start), \
57  xroad_time_t: xroad_timer_start_repeat_tm, \
58  default: xroad_timer_start_repeat_int \
59  )(timer, start, repeat)
60 
61 #endif
62 
69 xroad_errno_t xroad_timer_repeat(xroad_timer_t* tm, uint64_t interval);
70 
76 
82 
86 #define __xroad_timer_dtor__ __dtor__(xroad_timer_destructor)
87 void xroad_timer_destructor(xroad_timer_t** timer);
88 
94 
101 
102 #ifdef __cplusplus
103 }
104 #endif
Definition: xroad_string.h:29
Definition: xroad_timer.h:23
void * ctx
callback context
Definition: xroad_timer.h:24
struct timer_s xroad_timer_t
see common/xroad_timer.h for details
Definition: xroad_common_fwd.h:61
void xroad_timer_stop(xroad_timer_t *tm)
bool xroad_timer_is_armed(const xroad_timer_t *tm)
void xroad_timer_destroy(xroad_timer_t *tm)
xroad_timer_t * xroad_timer_create(xroad_str_t name, xroad_timer_callback_t cb)
xroad_errno_t xroad_timer_repeat(xroad_timer_t *tm, uint64_t interval)
xroad_str_t xroad_timer_get_name(const xroad_timer_t *tm)