diff options
Diffstat (limited to 'toxav/event.h')
-rw-r--r-- | toxav/event.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/toxav/event.h b/toxav/event.h new file mode 100644 index 00000000..0fb2d120 --- /dev/null +++ b/toxav/event.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /** event.h | ||
2 | * | ||
3 | * Copyright (C) 2013 Tox project All Rights Reserved. | ||
4 | * | ||
5 | * This file is part of Tox. | ||
6 | * | ||
7 | * Tox is free software: you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation, either version 3 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * Tox is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
19 | * | ||
20 | * | ||
21 | * Report bugs/suggestions at #tox-dev @ freenode.net:6667 | ||
22 | */ | ||
23 | |||
24 | |||
25 | #ifndef __TOXEVENT | ||
26 | #define __TOXEVENT | ||
27 | |||
28 | |||
29 | /** | ||
30 | * - Events are, in fact, ran in their own threads upon execution. | ||
31 | * - Event handler is initialized at the start, before the main() function | ||
32 | * and terminated after it's execution. | ||
33 | * - Timers are checked for timeout every ~10000 ns. | ||
34 | * - Timers can be canceled or ran immediately via | ||
35 | * timer_release() or timer_now() functions. | ||
36 | * - Timeout is measured in milliseconds. | ||
37 | * | ||
38 | * NOTE: timer_reset () and timer_now() are not tested nor usable atm | ||
39 | * | ||
40 | */ | ||
41 | extern struct _Event { | ||
42 | int (*rise) (void * ( func ) ( void * ), void *arg); | ||
43 | int (*timer_reset ) ( int id, unsigned timeout ); | ||
44 | int (*timer_alloc) (void * ( func ) ( void * ), void *arg, unsigned timeout); | ||
45 | int (*timer_release) (int id); | ||
46 | int (*timer_now) ( int id ); | ||
47 | } event; | ||
48 | |||
49 | #endif /* _MSI__EVENT_H_ */ | ||