2011-03-12 19:43:52 +03:00
|
|
|
#ifndef __QEMU_THREAD_POSIX_H
|
|
|
|
#define __QEMU_THREAD_POSIX_H 1
|
|
|
|
#include "pthread.h"
|
2011-08-08 16:36:41 +04:00
|
|
|
#include <semaphore.h>
|
2011-03-12 19:43:52 +03:00
|
|
|
|
|
|
|
struct QemuMutex {
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct QemuCond {
|
|
|
|
pthread_cond_t cond;
|
|
|
|
};
|
|
|
|
|
2011-08-08 16:36:41 +04:00
|
|
|
struct QemuSemaphore {
|
2012-12-28 10:38:11 +04:00
|
|
|
#if defined(__APPLE__) || defined(__NetBSD__)
|
2012-11-02 18:43:21 +04:00
|
|
|
pthread_mutex_t lock;
|
|
|
|
pthread_cond_t cond;
|
2013-07-03 12:58:14 +04:00
|
|
|
unsigned int count;
|
2012-11-02 18:43:21 +04:00
|
|
|
#else
|
2011-08-08 16:36:41 +04:00
|
|
|
sem_t sem;
|
2012-11-02 18:43:21 +04:00
|
|
|
#endif
|
2011-08-08 16:36:41 +04:00
|
|
|
};
|
|
|
|
|
2013-09-25 10:20:59 +04:00
|
|
|
struct QemuEvent {
|
|
|
|
#ifndef __linux__
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
pthread_cond_t cond;
|
|
|
|
#endif
|
|
|
|
unsigned value;
|
|
|
|
};
|
|
|
|
|
2011-03-12 19:43:52 +03:00
|
|
|
struct QemuThread {
|
|
|
|
pthread_t thread;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|