Haka: include/haka/timer.h Source File

Haka

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

timer.h
Go to the documentation of this file.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
10 #ifndef HAKA_TIMER_H
11 #define HAKA_TIMER_H
12
13 #include <haka/types.h>
14 #include <haka/time.h>
15 #include <haka/thread.h>
16
17
21 enum time_realm_mode {
22 TIME_REALM_REALTIME, /* Real-time timer. */
23 TIME_REALM_STATIC /* Static time. The time must be updated manually. */
24 };
25
27 struct time_realm {
28 enum time_realm_mode mode;
29 local_storage_t states; /* struct timer_group_state */;
30 };
31
32 struct timer;
38 typedef void (*timer_callback)(int count, void *data);
39
43 bool time_realm_initialize(struct time_realm *realm, enum time_realm_mode mode);
44
48 bool time_realm_destroy(struct time_realm *realm);
49
54 void time_realm_update_and_check(struct time_realm *realm, const struct time *value);
55
59 const struct time *time_realm_current_time(struct time_realm *realm);
60
64 struct timer *time_realm_timer(struct time_realm *realm, timer_callback callback, void *user);
65
69 bool time_realm_check(struct time_realm *realm);
70
75 bool timer_init_thread();
76
80 void timer_destroy(struct timer *timer);
81
86 bool timer_once(struct timer *timer, struct time *delay);
87
92 bool timer_repeat(struct timer *timer, struct time *delay);
93
98 bool timer_stop(struct timer *timer);
99
100 #endif /* HAKA_TIMER_H */
types.h
time.h
timer_once
bool timer_once(struct timer *timer, struct time *delay)
Definition: timer.c:345
time_realm_update_and_check
void time_realm_update_and_check(struct time_realm *realm, const struct time *value)
Definition: timer.c:144
time_realm_check
bool time_realm_check(struct time_realm *realm)
Definition: timer.c:434
timer_stop
bool timer_stop(struct timer *timer)
Definition: timer.c:355
timer_init_thread
bool timer_init_thread()
Definition: timer.c:203
timer_callback
void(* timer_callback)(int count, void *data)
Definition: timer.h:38
timer_destroy
void timer_destroy(struct timer *timer)
Definition: timer.c:320
time_realm_mode
time_realm_mode
Definition: timer.h:21
timer_repeat
bool timer_repeat(struct timer *timer, struct time *delay)
Definition: timer.c:350
time_realm_destroy
bool time_realm_destroy(struct time_realm *realm)
Definition: timer.c:133
time_realm_initialize
bool time_realm_initialize(struct time_realm *realm, enum time_realm_mode mode)
Definition: timer.c:114
time_realm
Definition: timer.h:27
local_storage_t
pthread_key_t local_storage_t
Definition: thread.h:226
time
Definition: time.h:21
time_realm_current_time
const struct time * time_realm_current_time(struct time_realm *realm)
Definition: timer.c:181
time_realm_timer
struct timer * time_realm_timer(struct time_realm *realm, timer_callback callback, void *user)
Definition: timer.c:216