2016-06-29 14:47:03 +03:00
|
|
|
#ifndef QEMU_THREAD_WIN32_H
|
|
|
|
#define QEMU_THREAD_WIN32_H
|
2016-06-22 20:11:19 +03:00
|
|
|
|
|
|
|
#include <windows.h>
|
2011-03-12 19:43:52 +03:00
|
|
|
|
|
|
|
struct QemuMutex {
|
2017-03-25 01:01:41 +03:00
|
|
|
SRWLOCK lock;
|
2018-06-13 15:23:08 +03:00
|
|
|
#ifdef CONFIG_DEBUG_MUTEX
|
|
|
|
const char *file;
|
|
|
|
int line;
|
|
|
|
#endif
|
2017-07-04 15:23:25 +03:00
|
|
|
bool initialized;
|
2011-03-12 19:43:52 +03:00
|
|
|
};
|
|
|
|
|
2016-10-27 13:49:07 +03:00
|
|
|
typedef struct QemuRecMutex QemuRecMutex;
|
|
|
|
struct QemuRecMutex {
|
|
|
|
CRITICAL_SECTION lock;
|
2017-07-04 15:23:25 +03:00
|
|
|
bool initialized;
|
2016-10-27 13:49:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
void qemu_rec_mutex_destroy(QemuRecMutex *mutex);
|
2017-08-08 20:53:15 +03:00
|
|
|
void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line);
|
|
|
|
int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file,
|
|
|
|
int line);
|
2016-10-27 13:49:07 +03:00
|
|
|
void qemu_rec_mutex_unlock(QemuRecMutex *mutex);
|
|
|
|
|
2011-03-12 19:43:52 +03:00
|
|
|
struct QemuCond {
|
2017-03-25 01:01:41 +03:00
|
|
|
CONDITION_VARIABLE var;
|
2017-07-04 15:23:25 +03:00
|
|
|
bool initialized;
|
2011-03-12 19:43:52 +03:00
|
|
|
};
|
|
|
|
|
2011-08-08 16:36:41 +04:00
|
|
|
struct QemuSemaphore {
|
|
|
|
HANDLE sema;
|
2017-07-04 15:23:25 +03:00
|
|
|
bool initialized;
|
2011-08-08 16:36:41 +04:00
|
|
|
};
|
|
|
|
|
2013-09-25 10:20:59 +04:00
|
|
|
struct QemuEvent {
|
2015-08-12 16:38:18 +03:00
|
|
|
int value;
|
2013-09-25 10:20:59 +04:00
|
|
|
HANDLE event;
|
2017-07-04 15:23:25 +03:00
|
|
|
bool initialized;
|
2013-09-25 10:20:59 +04:00
|
|
|
};
|
|
|
|
|
2011-12-12 20:21:33 +04:00
|
|
|
typedef struct QemuThreadData QemuThreadData;
|
2011-03-12 19:43:52 +03:00
|
|
|
struct QemuThread {
|
2011-12-12 20:21:33 +04:00
|
|
|
QemuThreadData *data;
|
|
|
|
unsigned tid;
|
2011-03-12 19:43:52 +03:00
|
|
|
};
|
|
|
|
|
2011-12-13 16:43:52 +04:00
|
|
|
/* Only valid for joinable threads. */
|
2019-08-12 08:23:31 +03:00
|
|
|
HANDLE qemu_thread_get_handle(struct QemuThread *thread);
|
2011-12-13 16:43:52 +04:00
|
|
|
|
2011-03-12 19:43:52 +03:00
|
|
|
#endif
|