1#ifndef __QEMU_THREAD_H 2#define __QEMU_THREAD_H 1 3 4#include <inttypes.h> 5 6typedef struct QemuMutex QemuMutex; 7typedef struct QemuCond QemuCond; 8typedef struct QemuThread QemuThread; 9 10#ifdef _WIN32 11#include "qemu-thread-win32.h" 12#else 13#include "qemu-thread-posix.h" 14#endif 15 16#define QEMU_THREAD_JOINABLE 0 17#define QEMU_THREAD_DETACHED 1 18 19void qemu_mutex_init(QemuMutex *mutex); 20void qemu_mutex_destroy(QemuMutex *mutex); 21void qemu_mutex_lock(QemuMutex *mutex); 22int qemu_mutex_trylock(QemuMutex *mutex); 23void qemu_mutex_unlock(QemuMutex *mutex); 24 25#define rcu_read_lock() do { } while (0) 26#define rcu_read_unlock() do { } while (0) 27 28void qemu_cond_init(QemuCond *cond); 29void qemu_cond_destroy(QemuCond *cond); 30 31/* 32 * IMPORTANT: The implementation does not guarantee that pthread_cond_signal 33 * and pthread_cond_broadcast can be called except while the same mutex is 34 * held as in the corresponding pthread_cond_wait calls! 35 */ 36void qemu_cond_signal(QemuCond *cond); 37void qemu_cond_broadcast(QemuCond *cond); 38void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex); 39 40void qemu_thread_create(QemuThread *thread, 41 void *(*start_routine)(void *), 42 void *arg, int mode); 43void *qemu_thread_join(QemuThread *thread); 44void qemu_thread_get_self(QemuThread *thread); 45int qemu_thread_is_self(QemuThread *thread); 46void qemu_thread_exit(void *retval); 47 48#endif 49