]> git.proxmox.com Git - qemu.git/blame - qemu-thread.h
target-mips: Enable access to required RDHWR hardware registers
[qemu.git] / qemu-thread.h
CommitLineData
e5d355d1
AL
1#ifndef __QEMU_THREAD_H
2#define __QEMU_THREAD_H 1
e5d355d1 3
65097429 4#include <inttypes.h>
2d797b65 5#include <stdbool.h>
65097429 6
e5d355d1
AL
7typedef struct QemuMutex QemuMutex;
8typedef struct QemuCond QemuCond;
9typedef struct QemuThread QemuThread;
10
9257d46d
PB
11#ifdef _WIN32
12#include "qemu-thread-win32.h"
13#else
14#include "qemu-thread-posix.h"
15#endif
16
cf218714
JK
17#define QEMU_THREAD_JOINABLE 0
18#define QEMU_THREAD_DETACHED 1
19
e5d355d1 20void qemu_mutex_init(QemuMutex *mutex);
313b1d69 21void qemu_mutex_destroy(QemuMutex *mutex);
e5d355d1
AL
22void qemu_mutex_lock(QemuMutex *mutex);
23int qemu_mutex_trylock(QemuMutex *mutex);
e5d355d1
AL
24void qemu_mutex_unlock(QemuMutex *mutex);
25
5f7d05ec
HPB
26#define rcu_read_lock() do { } while (0)
27#define rcu_read_unlock() do { } while (0)
28
e5d355d1 29void qemu_cond_init(QemuCond *cond);
313b1d69 30void qemu_cond_destroy(QemuCond *cond);
9257d46d
PB
31
32/*
33 * IMPORTANT: The implementation does not guarantee that pthread_cond_signal
34 * and pthread_cond_broadcast can be called except while the same mutex is
35 * held as in the corresponding pthread_cond_wait calls!
36 */
e5d355d1
AL
37void qemu_cond_signal(QemuCond *cond);
38void qemu_cond_broadcast(QemuCond *cond);
39void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
e5d355d1
AL
40
41void qemu_thread_create(QemuThread *thread,
cf218714
JK
42 void *(*start_routine)(void *),
43 void *arg, int mode);
44void *qemu_thread_join(QemuThread *thread);
b7680cb6 45void qemu_thread_get_self(QemuThread *thread);
2d797b65 46bool qemu_thread_is_self(QemuThread *thread);
313b1d69
CC
47void qemu_thread_exit(void *retval);
48
e5d355d1 49#endif