2
0

qemu-thread.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef __QEMU_THREAD_H
  2. #define __QEMU_THREAD_H 1
  3. #include <inttypes.h>
  4. typedef struct QemuMutex QemuMutex;
  5. typedef struct QemuCond QemuCond;
  6. typedef struct QemuThread QemuThread;
  7. #ifdef _WIN32
  8. #include "qemu-thread-win32.h"
  9. #else
  10. #include "qemu-thread-posix.h"
  11. #endif
  12. #define QEMU_THREAD_JOINABLE 0
  13. #define QEMU_THREAD_DETACHED 1
  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);
  19. #define rcu_read_lock() do { } while (0)
  20. #define rcu_read_unlock() do { } while (0)
  21. void qemu_cond_init(QemuCond *cond);
  22. void qemu_cond_destroy(QemuCond *cond);
  23. /*
  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!
  27. */
  28. void qemu_cond_signal(QemuCond *cond);
  29. void qemu_cond_broadcast(QemuCond *cond);
  30. void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
  31. void qemu_thread_create(QemuThread *thread,
  32. void *(*start_routine)(void *),
  33. void *arg, int mode);
  34. void *qemu_thread_join(QemuThread *thread);
  35. void qemu_thread_get_self(QemuThread *thread);
  36. int qemu_thread_is_self(QemuThread *thread);
  37. void qemu_thread_exit(void *retval);
  38. #endif