aboutsummaryrefslogtreecommitdiffstats
path: root/man2/futex.2
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-05-03 22:29:53 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-03 22:29:53 +0200
commit041a155c49100a6f458f797982ff18e25f1dc01c (patch)
tree5c2e63df99d1e2e573eeadf04a5a59e4c3fb014d /man2/futex.2
parent4687ab0e1215485f69223684e2f1b16095f4a40c (diff)
downloadman-pages-041a155c49100a6f458f797982ff18e25f1dc01c.tar.gz
Various pages: EXAMPLES: Separate declarations from code
Reported-by: checkpatch(1) Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'man2/futex.2')
-rw-r--r--man2/futex.28
1 files changed, 4 insertions, 4 deletions
diff --git a/man2/futex.2 b/man2/futex.2
index 5a68519563..e48a0b5c91 100644
--- a/man2/futex.2
+++ b/man2/futex.2
@@ -1836,7 +1836,8 @@ futex(uint32_t *uaddr, int futex_op, uint32_t val,
static void
fwait(uint32_t *futexp)
{
- long s;
+ long s;
+ const uint32_t one = 1;
/* atomic_compare_exchange_strong(ptr, oldval, newval)
atomically performs the equivalent of:
@@ -1849,7 +1850,6 @@ fwait(uint32_t *futexp)
while (1) {
/* Is the futex available? */
- const uint32_t one = 1;
if (atomic_compare_exchange_strong(futexp, &one, 0))
break; /* Yes */
@@ -1868,12 +1868,12 @@ fwait(uint32_t *futexp)
static void
fpost(uint32_t *futexp)
{
- long s;
+ long s;
+ const uint32_t zero = 0;
/* atomic_compare_exchange_strong() was described
in comments above. */
- const uint32_t zero = 0;
if (atomic_compare_exchange_strong(futexp, &zero, 1)) {
s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);
if (s == \-1)