]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/nptl/lowlevellock-futex.h
53fd53d1d46c81aa279628f90c5e1fabfc6c68d4
1 /* Low-level locking access to futex facilities. Stub version.
2 Copyright (C) 2014-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _LOWLEVELLOCK_FUTEX_H
20 #define _LOWLEVELLOCK_FUTEX_H 1
25 /* Values for 'private' parameter of locking macros. Note pthreadP.h
26 optimizes for these exact values, though they are not required. */
28 #define LLL_SHARED 128
31 /* For most of these macros, the return value is never really used.
32 Nevertheless, the protocol is that each one returns a negated errno
33 code for failure or zero for success. (Note that the corresponding
34 Linux system calls can sometimes return positive values for success
35 cases too. We never use those values.) */
38 /* Wait while *FUTEXP == VAL for an lll_futex_wake call on FUTEXP. */
39 #define lll_futex_wait(futexp, val, private) \
40 lll_futex_timed_wait (futexp, val, NULL, private)
42 /* Wait until a lll_futex_wake call on FUTEXP, or TIMEOUT elapses. */
43 #define lll_futex_timed_wait(futexp, val, timeout, private) \
46 /* Verify whether the supplied clockid is supported by
47 lll_futex_clock_wait_bitset. */
48 #define lll_futex_supported_clockid(clockid) \
51 /* Wait until a lll_futex_wake call on FUTEXP, or the absolute TIMEOUT
52 measured against CLOCKID elapses. CLOCKID may be CLOCK_REALTIME or
54 #define lll_futex_clock_wait_bitset(futexp, val, clockid, timeout, private) \
57 /* Wake up up to NR waiters on FUTEXP. */
58 #define lll_futex_wake(futexp, nr, private) \
61 /* Wake up up to NR_WAKE waiters on FUTEXP. Move up to NR_MOVE of the
62 rest from waiting on FUTEXP to waiting on MUTEX (a different futex). */
63 #define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
66 /* Wake up up to NR_WAKE waiters on FUTEXP and NR_WAKE2 on FUTEXP2. */
67 #define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
71 /* Like lll_futex_wait (FUTEXP, VAL, PRIVATE) but with the expectation
72 that lll_futex_cmp_requeue_pi (FUTEXP, _, _, MUTEX, _, PRIVATE) will
73 be used to do the wakeup. Confers priority-inheritance behavior on
75 #define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
76 lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
78 /* Like lll_futex_wait_requeue_pi, but with a timeout. */
79 #define lll_futex_timed_wait_requeue_pi(futexp, val, timeout, clockbit, \
83 /* Like lll_futex_requeue, but pairs with lll_futex_wait_requeue_pi
84 and inherits priority from the waiter. */
85 #define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, \
89 /* Like lll_futex_wait, but acting as a cancellable entrypoint. */
90 #define lll_futex_wait_cancel(futexp, val, private) \
93 /* Like lll_futex_timed_wait, but acting as a cancellable entrypoint. */
94 #define lll_futex_timed_wait_cancel(futexp, val, timeout, private) \
97 #endif /* lowlevellock-futex.h */