qemu/include/qemu/thread-posix.h
<<
>>
Prefs
   1#ifndef QEMU_THREAD_POSIX_H
   2#define QEMU_THREAD_POSIX_H
   3
   4#include <pthread.h>
   5#include <semaphore.h>
   6
   7typedef QemuMutex QemuRecMutex;
   8#define qemu_rec_mutex_destroy qemu_mutex_destroy
   9#define qemu_rec_mutex_lock qemu_mutex_lock
  10#define qemu_rec_mutex_try_lock qemu_mutex_try_lock
  11#define qemu_rec_mutex_unlock qemu_mutex_unlock
  12
  13struct QemuMutex {
  14    pthread_mutex_t lock;
  15};
  16
  17struct QemuCond {
  18    pthread_cond_t cond;
  19};
  20
  21struct QemuSemaphore {
  22#if defined(__APPLE__) || defined(__NetBSD__)
  23    pthread_mutex_t lock;
  24    pthread_cond_t cond;
  25    unsigned int count;
  26#else
  27    sem_t sem;
  28#endif
  29};
  30
  31struct QemuEvent {
  32#ifndef __linux__
  33    pthread_mutex_t lock;
  34    pthread_cond_t cond;
  35#endif
  36    unsigned value;
  37};
  38
  39struct QemuThread {
  40    pthread_t thread;
  41};
  42
  43#endif
  44