]> Git Repo - qemu.git/blob - include/qemu/thread.h
input: map INPUT_BUTTON_WHEEL_{UP,DOWN} to legacy input z axis moves.
[qemu.git] / include / qemu / thread.h
1 #ifndef __QEMU_THREAD_H
2 #define __QEMU_THREAD_H 1
3
4 #include <inttypes.h>
5 #include <stdbool.h>
6
7 typedef struct QemuMutex QemuMutex;
8 typedef struct QemuCond QemuCond;
9 typedef struct QemuSemaphore QemuSemaphore;
10 typedef struct QemuEvent QemuEvent;
11 typedef struct QemuThread QemuThread;
12
13 #ifdef _WIN32
14 #include "qemu/thread-win32.h"
15 #else
16 #include "qemu/thread-posix.h"
17 #endif
18
19 #define QEMU_THREAD_JOINABLE 0
20 #define QEMU_THREAD_DETACHED 1
21
22 void qemu_mutex_init(QemuMutex *mutex);
23 void qemu_mutex_destroy(QemuMutex *mutex);
24 void qemu_mutex_lock(QemuMutex *mutex);
25 int qemu_mutex_trylock(QemuMutex *mutex);
26 void qemu_mutex_unlock(QemuMutex *mutex);
27
28 #define rcu_read_lock() do { } while (0)
29 #define rcu_read_unlock() do { } while (0)
30
31 void qemu_cond_init(QemuCond *cond);
32 void qemu_cond_destroy(QemuCond *cond);
33
34 /*
35  * IMPORTANT: The implementation does not guarantee that pthread_cond_signal
36  * and pthread_cond_broadcast can be called except while the same mutex is
37  * held as in the corresponding pthread_cond_wait calls!
38  */
39 void qemu_cond_signal(QemuCond *cond);
40 void qemu_cond_broadcast(QemuCond *cond);
41 void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
42
43 void qemu_sem_init(QemuSemaphore *sem, int init);
44 void qemu_sem_post(QemuSemaphore *sem);
45 void qemu_sem_wait(QemuSemaphore *sem);
46 int qemu_sem_timedwait(QemuSemaphore *sem, int ms);
47 void qemu_sem_destroy(QemuSemaphore *sem);
48
49 void qemu_event_init(QemuEvent *ev, bool init);
50 void qemu_event_set(QemuEvent *ev);
51 void qemu_event_reset(QemuEvent *ev);
52 void qemu_event_wait(QemuEvent *ev);
53 void qemu_event_destroy(QemuEvent *ev);
54
55 void qemu_thread_create(QemuThread *thread,
56                         void *(*start_routine)(void *),
57                         void *arg, int mode);
58 void *qemu_thread_join(QemuThread *thread);
59 void qemu_thread_get_self(QemuThread *thread);
60 bool qemu_thread_is_self(QemuThread *thread);
61 void qemu_thread_exit(void *retval);
62
63 #endif
This page took 0.027825 seconds and 4 git commands to generate.