source:
azure_iot_hub/trunk/musl-1.1.18/src/thread/__wait.c
Last change on this file was 389, checked in by , 5 years ago | |
---|---|
|
|
File size: 449 bytes |
Rev | Line | |
---|---|---|
[388] | 1 | #include "pthread_impl.h" |
2 | ||
3 | void __wait(volatile int *addr, volatile int *waiters, int val, int priv) | |
4 | { | |
5 | int spins=100; | |
6 | if (priv) priv = FUTEX_PRIVATE; | |
7 | while (spins-- && (!waiters || !*waiters)) { | |
8 | if (*addr==val) a_spin(); | |
9 | else return; | |
10 | } | |
11 | if (waiters) a_inc(waiters); | |
12 | while (*addr==val) { | |
13 | __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0) != -ENOSYS | |
14 | || __syscall(SYS_futex, addr, FUTEX_WAIT, val, 0); | |
15 | } | |
16 | if (waiters) a_dec(waiters); | |
17 | } |
Note:
See TracBrowser
for help on using the repository browser.