2
0

qemu-thread.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. void qemu_mutex_init(QemuMutex *mutex);
  13. void qemu_mutex_destroy(QemuMutex *mutex);
  14. void qemu_mutex_lock(QemuMutex *mutex);
  15. int qemu_mutex_trylock(QemuMutex *mutex);
  16. void qemu_mutex_unlock(QemuMutex *mutex);
  17. #define rcu_read_lock() do { } while (0)
  18. #define rcu_read_unlock() do { } while (0)
  19. void qemu_cond_init(QemuCond *cond);
  20. void qemu_cond_destroy(QemuCond *cond);
  21. /*
  22. * IMPORTANT: The implementation does not guarantee that pthread_cond_signal
  23. * and pthread_cond_broadcast can be called except while the same mutex is
  24. * held as in the corresponding pthread_cond_wait calls!
  25. */
  26. void qemu_cond_signal(QemuCond *cond);
  27. void qemu_cond_broadcast(QemuCond *cond);
  28. void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
  29. void qemu_thread_create(QemuThread *thread,
  30. void *(*start_routine)(void*),
  31. void *arg);
  32. void qemu_thread_get_self(QemuThread *thread);
  33. int qemu_thread_is_self(QemuThread *thread);
  34. void qemu_thread_exit(void *retval);
  35. #endif