Merge remote branch 'amit/for-anthony' into staging
[qemu.git] / qemu-thread.h
blobedc7ab68589e9b3875d19a886b4e64191485af27
1 #ifndef __QEMU_THREAD_H
2 #define __QEMU_THREAD_H 1
4 typedef struct QemuMutex QemuMutex;
5 typedef struct QemuCond QemuCond;
6 typedef struct QemuThread QemuThread;
8 #ifdef _WIN32
9 #include "qemu-thread-win32.h"
10 #else
11 #include "qemu-thread-posix.h"
12 #endif
14 void qemu_mutex_init(QemuMutex *mutex);
15 void qemu_mutex_destroy(QemuMutex *mutex);
16 void qemu_mutex_lock(QemuMutex *mutex);
17 int qemu_mutex_trylock(QemuMutex *mutex);
18 void qemu_mutex_unlock(QemuMutex *mutex);
20 void qemu_cond_init(QemuCond *cond);
21 void qemu_cond_destroy(QemuCond *cond);
24 * IMPORTANT: The implementation does not guarantee that pthread_cond_signal
25 * and pthread_cond_broadcast can be called except while the same mutex is
26 * held as in the corresponding pthread_cond_wait calls!
28 void qemu_cond_signal(QemuCond *cond);
29 void qemu_cond_broadcast(QemuCond *cond);
30 void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
32 void qemu_thread_create(QemuThread *thread,
33 void *(*start_routine)(void*),
34 void *arg);
35 void qemu_thread_get_self(QemuThread *thread);
36 int qemu_thread_is_self(QemuThread *thread);
37 void qemu_thread_exit(void *retval);
39 #endif