]>
Commit | Line | Data |
---|---|---|
2a6a4076 MA |
1 | #ifndef QEMU_THREAD_POSIX_H |
2 | #define QEMU_THREAD_POSIX_H | |
a9c94277 MA |
3 | |
4 | #include <pthread.h> | |
38b14db3 | 5 | #include <semaphore.h> |
9257d46d PB |
6 | |
7 | struct QemuMutex { | |
8 | pthread_mutex_t lock; | |
ba59fb77 PB |
9 | #ifdef CONFIG_DEBUG_MUTEX |
10 | const char *file; | |
11 | int line; | |
12 | #endif | |
c096358e | 13 | bool initialized; |
9257d46d PB |
14 | }; |
15 | ||
6c98635e RH |
16 | /* |
17 | * QemuRecMutex cannot be a typedef of QemuMutex lest we have two | |
18 | * compatible cases in _Generic. See qemu/lockable.h. | |
19 | */ | |
20 | typedef struct QemuRecMutex { | |
21 | QemuMutex m; | |
22 | } QemuRecMutex; | |
23 | ||
9257d46d PB |
24 | struct QemuCond { |
25 | pthread_cond_t cond; | |
c096358e | 26 | bool initialized; |
9257d46d PB |
27 | }; |
28 | ||
38b14db3 | 29 | struct QemuSemaphore { |
401bc051 | 30 | #ifndef CONFIG_SEM_TIMEDWAIT |
c166cb72 PB |
31 | pthread_mutex_t lock; |
32 | pthread_cond_t cond; | |
79761c66 | 33 | unsigned int count; |
c166cb72 | 34 | #else |
38b14db3 | 35 | sem_t sem; |
c166cb72 | 36 | #endif |
c096358e | 37 | bool initialized; |
38b14db3 PB |
38 | }; |
39 | ||
c7c4d063 PB |
40 | struct QemuEvent { |
41 | #ifndef __linux__ | |
42 | pthread_mutex_t lock; | |
43 | pthread_cond_t cond; | |
44 | #endif | |
45 | unsigned value; | |
c096358e | 46 | bool initialized; |
c7c4d063 PB |
47 | }; |
48 | ||
9257d46d PB |
49 | struct QemuThread { |
50 | pthread_t thread; | |
51 | }; | |
52 | ||
9257d46d | 53 | #endif |