2
3
4
14#pragma comment(lib, "synchronization")
17
18
19
20#define ae2f_addrel_t LONG
23
24
25
26
27
28
29#define __ae2f_win_wait(uaddr, v)
30 { int vv = v; WaitOnAddress(((volatile LONG*)(uaddr)), &vv, sizeof(int), INFINITE); }
33
34
35
36#define __ae2f_win_wakesingle(uaddr)
37 WakeByAddressSingle((PVOID)(uaddr))
39#define __ae2f_WakeSingle __ae2f_win_wakesingle
40#define __ae2f_Wait __ae2f_win_wait
45#include <linux/futex.h>
46#include <sys/syscall.h>
50
51
52
53#define ae2f_addrel_t int
56
57
58
59
60
61
62
63
64
65#define __ae2f_futex(uaddr, op, val, timeout, uaddr2, val3)
66 syscall(SYS_futex
, uaddr, op, val, timeout, uaddr2, val3)
70
71
72
73
74
75
76#define __ae2f_futex_wait(uaddr, v)
77 __ae2f_futex
(uaddr, FUTEX_WAIT
, v, NULL
, NULL
, 0
)
80
81
82
83
84
85
86#define __ae2f_futex_wake(uaddr, n)
87 __ae2f_futex
(uaddr, FUTEX_WAKE
, n, NULL
, NULL
, 0
)
91
92
93
94#define __ae2f_futex_wakesigle(uaddr)
95 __ae2f_futex_wake
(uaddr, 1
)
99#define __ae2f_Wait __ae2f_futex_wait
100#define __ae2f_WakeSingle __ae2f_futex_wakesigle
109
110
111#define ae2f_addrel_t int32_t
114
115
116static pthread_mutex_t __ae2f_osx_mutex = PTHREAD_MUTEX_INITIALIZER;
117static pthread_cond_t __ae2f_osx_cond = PTHREAD_COND_INITIALIZER;
120
121
122
123
124
125#define __ae2f_osx_wait(uaddr, v)
127 if (pthread_mutex_lock(&__ae2f_osx_mutex) != 0
) {
131 while (*(uaddr) == (v) && __ret == 0
) {
132 if (pthread_cond_wait(&__ae2f_osx_cond, &__ae2f_osx_mutex) != 0
) {
137 if (pthread_mutex_unlock(&__ae2f_osx_mutex) != 0
) {
145
146
147
148
149#define __ae2f_osx_wakesingle(uaddr)
151 if (pthread_mutex_lock(&__ae2f_osx_mutex) != 0
) {
155 if (pthread_cond_signal(&__ae2f_osx_cond) != 0
) {
159 if (pthread_mutex_unlock(&__ae2f_osx_mutex) != 0
) {
166#define __ae2f_Wait __ae2f_osx_wait
167#define __ae2f_WakeSingle __ae2f_osx_wakesingle
#define __ae2f_WakeSingle
#define ae2f_addrel_t
Address element type.