summaryrefslogtreecommitdiff
path: root/toxmsi/toxmsi_event.h
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2013-10-13 16:16:47 +0200
committerBtbN <btbn@btbn.de>2013-10-13 16:16:47 +0200
commitda727875ac954b13ecb16521d255499511bb7424 (patch)
tree551904f3738612e9c15d98f320c323aa325a5cf8 /toxmsi/toxmsi_event.h
parent1b971de651278429eea312f3240e1c5b8fbc67a4 (diff)
tox A/V: RTP/MSI implementation
Diffstat (limited to 'toxmsi/toxmsi_event.h')
-rw-r--r--toxmsi/toxmsi_event.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/toxmsi/toxmsi_event.h b/toxmsi/toxmsi_event.h
new file mode 100644
index 00000000..032e4df5
--- /dev/null
+++ b/toxmsi/toxmsi_event.h
@@ -0,0 +1,46 @@
1#ifndef _MSI__EVENT_H_
2#define _MSI__EVENT_H_
3
4#include <stddef.h>
5#include <inttypes.h>
6#include <pthread.h>
7
8typedef void* event_arg_t;
9
10typedef void ( *event_t ) ( event_arg_t );
11typedef void ( *timed_event_t ) ( event_arg_t );
12
13typedef struct event_container_s {
14 event_t _event;
15 event_arg_t _event_args;
16 uint32_t _timeout;
17 long long _id;
18
19} event_container_t;
20
21typedef struct event_handler_s {
22 event_container_t* _events;
23 size_t _events_count;
24
25 event_container_t* _timed_events;
26 size_t _timed_events_count;
27
28 uint32_t _frequms;
29 int _running;
30
31 pthread_mutex_t _mutex;
32 pthread_t _thread_id;
33
34} event_handler_t;
35
36event_handler_t* init_event_poll ( uint32_t _frequms );
37int terminate_event_poll ( event_handler_t* _event_handler );
38
39void throw_event ( void* _event_handler_p, event_t _func, event_arg_t _arg );
40
41/* Not yet ready for use */
42int throw_timer_event ( void* _event_handler_p, event_t _func, event_arg_t _arg, uint32_t _timeout);
43int cancel_timer_event ( void* _event_handler_p, int _id );
44
45
46#endif /* _MSI__EVENT_H_ */