2016-06-29 11:47:03 +00:00
|
|
|
#ifndef QEMU_THREAD_POSIX_H
|
|
|
|
#define QEMU_THREAD_POSIX_H
|
2016-06-22 17:11:19 +00:00
|
|
|
|
|
|
|
#include <pthread.h>
|
2011-08-08 12:36:41 +00:00
|
|
|
#include <semaphore.h>
|
2011-03-12 16:43:52 +00:00
|
|
|
|
2016-10-27 10:49:07 +00:00
|
|
|
typedef QemuMutex QemuRecMutex;
|
|
|
|
#define qemu_rec_mutex_destroy qemu_mutex_destroy
|
2017-08-08 17:53:15 +00:00
|
|
|
#define qemu_rec_mutex_lock_impl qemu_mutex_lock_impl
|
|
|
|
#define qemu_rec_mutex_trylock_impl qemu_mutex_trylock_impl
|
2016-10-27 10:49:07 +00:00
|
|
|
#define qemu_rec_mutex_unlock qemu_mutex_unlock
|
|
|
|
|
2011-03-12 16:43:52 +00:00
|
|
|
struct QemuMutex {
|
|
|
|
pthread_mutex_t lock;
|
2018-06-13 12:23:08 +00:00
|
|
|
#ifdef CONFIG_DEBUG_MUTEX
|
|
|
|
const char *file;
|
|
|
|
int line;
|
|
|
|
#endif
|
2017-07-04 12:23:25 +00:00
|
|
|
bool initialized;
|
2011-03-12 16:43:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct QemuCond {
|
|
|
|
pthread_cond_t cond;
|
2017-07-04 12:23:25 +00:00
|
|
|
bool initialized;
|
2011-03-12 16:43:52 +00:00
|
|
|
};
|
|
|
|
|
2011-08-08 12:36:41 +00:00
|
|
|
struct QemuSemaphore {
|
2017-09-05 12:19:32 +00:00
|
|
|
#ifndef CONFIG_SEM_TIMEDWAIT
|
2012-11-02 14:43:21 +00:00
|
|
|
pthread_mutex_t lock;
|
|
|
|
pthread_cond_t cond;
|
2013-07-03 08:58:14 +00:00
|
|
|
unsigned int count;
|
2012-11-02 14:43:21 +00:00
|
|
|
#else
|
2011-08-08 12:36:41 +00:00
|
|
|
sem_t sem;
|
2012-11-02 14:43:21 +00:00
|
|
|
#endif
|
2017-07-04 12:23:25 +00:00
|
|
|
bool initialized;
|
2011-08-08 12:36:41 +00:00
|
|
|
};
|
|
|
|
|
2013-09-25 06:20:59 +00:00
|
|
|
struct QemuEvent {
|
|
|
|
#ifndef __linux__
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
pthread_cond_t cond;
|
|
|
|
#endif
|
|
|
|
unsigned value;
|
2017-07-04 12:23:25 +00:00
|
|
|
bool initialized;
|
2013-09-25 06:20:59 +00:00
|
|
|
};
|
|
|
|
|
2011-03-12 16:43:52 +00:00
|
|
|
struct QemuThread {
|
|
|
|
pthread_t thread;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|