2011-03-13 00:43:52 +08:00
|
|
|
#ifndef __QEMU_THREAD_POSIX_H
|
|
|
|
#define __QEMU_THREAD_POSIX_H 1
|
|
|
|
#include "pthread.h"
|
2011-08-08 20:36:41 +08:00
|
|
|
#include <semaphore.h>
|
2011-03-13 00:43:52 +08:00
|
|
|
|
|
|
|
struct QemuMutex {
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct QemuCond {
|
|
|
|
pthread_cond_t cond;
|
|
|
|
};
|
|
|
|
|
2011-08-08 20:36:41 +08:00
|
|
|
struct QemuSemaphore {
|
2012-11-02 22:43:21 +08:00
|
|
|
#if defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__)
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
pthread_cond_t cond;
|
|
|
|
int count;
|
|
|
|
#else
|
2011-08-08 20:36:41 +08:00
|
|
|
sem_t sem;
|
2012-11-02 22:43:21 +08:00
|
|
|
#endif
|
2011-08-08 20:36:41 +08:00
|
|
|
};
|
|
|
|
|
2011-03-13 00:43:52 +08:00
|
|
|
struct QemuThread {
|
|
|
|
pthread_t thread;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|