2
* Wrappers around Linux futex syscall
4
* Copyright Red Hat, Inc. 2017
7
* Paolo Bonzini <pbonzini@redhat.com>
9
* This work is licensed under the terms of the GNU GPL, version 2 or later.
10
* See the COPYING file in the top-level directory.
14
#include <sys/syscall.h>
15
#include <linux/futex.h>
17
#define qemu_futex(...) syscall(__NR_futex, __VA_ARGS__)
19
static inline void qemu_futex_wake(void *f, int n)
21
qemu_futex(f, FUTEX_WAKE, n, NULL, NULL, 0);
24
static inline void qemu_futex_wait(void *f, unsigned val)
26
while (qemu_futex(f, FUTEX_WAIT, (int) val, NULL, NULL, 0)) {
31
break; /* get out of switch and retry */