summaryrefslogtreecommitdiff
path: root/toxcore/event.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/event.h')
-rwxr-xr-xtoxcore/event.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/toxcore/event.h b/toxcore/event.h
new file mode 100755
index 00000000..690cc1ca
--- /dev/null
+++ b/toxcore/event.h
@@ -0,0 +1,51 @@
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 to me ( mannol ) at either #tox-dev @ freenode.net:6667 or
22 * my email: eniz_vukovic@hotmail.com
23 */
24
25
26#ifndef __TOXEVENT
27#define __TOXEVENT
28
29
30/**
31 * - Events are, in fact, ran in their own threads upon execution.
32 * - Event handler is initialized at the start, before the main() function
33 * and terminated after it's execution.
34 * - Timers are checked for timeout every ~10000 ns.
35 * - Timers can be canceled or ran immediately via
36 * timer_release() or timer_now() functions.
37 * - Timeout is measured in milliseconds.
38 *
39 * NOTE: timer_reset () and timer_now() are not tested nor usable atm
40 *
41 */
42extern struct _Event
43{
44 int (*rise) (void* ( func ) ( void* ), void* arg);
45 int (*timer_reset ) ( int id, unsigned timeout );
46 int (*timer_alloc) (void* ( func ) ( void* ), void* arg, unsigned timeout);
47 int (*timer_release) (int id);
48 int (*timer_now) ( int id );
49} event;
50
51#endif /* _MSI__EVENT_H_ */