.\"
.TP
.BR FUTEX_WAIT (2const)
-.TP
-.BR FUTEX_WAKE " (since Linux 2.6.0)"
-.\" Strictly speaking, since Linux 2.5.x
-This operation wakes at most
-.I val
-of the waiters that are waiting (e.g., inside
-.BR FUTEX_WAIT (2const))
-on the futex word at the address
-.IR uaddr .
-Most commonly,
-.I val
-is specified as either 1 (wake up a single waiter) or
-.B INT_MAX
-(wake up all waiters).
-No guarantee is provided about which waiters are awoken
-(e.g., a waiter with a higher scheduling priority is not guaranteed
-to be awoken in preference to a waiter with a lower priority).
-.IP
-The arguments
-.IR timeout ,
-.IR uaddr2 ,
-and
-.I val3
-are ignored.
-.\" FIXME . (Torvald) I think we should remove this. Or maybe adapt to
-.\" a different example.
-.\"
-.\" For
-.\" .BR futex (7),
-.\" this is executed if incrementing the count showed that
-.\" there were waiters,
-.\" once the futex value has been set to 1
-.\" (indicating that it is available).
-.\"
-.\" How does "incrementing the count show that there were waiters"?
-.\"
-.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-.\"
+.TQ
+.BR FUTEX_WAKE (2const)
.TP
.BR FUTEX_FD " (from Linux 2.6.0 up to and including Linux 2.6.25)"
.\" Strictly speaking, from Linux 2.5.x to Linux 2.6.25
.IR uaddr .
The caller must close the returned file descriptor after use.
When another process or thread performs a
-.B FUTEX_WAKE
+.BR FUTEX_WAKE (2const)
on the futex word, the file descriptor indicates as being readable with
.BR select (2),
.BR poll (2),
The file descriptor can be used to obtain asynchronous notifications: if
.I val
is nonzero, then, when another process or thread executes a
-.BR FUTEX_WAKE ,
+.BR FUTEX_WAKE (2const),
the caller will receive the signal number that was passed in
.IR val .
.IP
because it would make the
.B FUTEX_CMP_REQUEUE
operation equivalent to
-.BR FUTEX_WAKE .)
+.BR FUTEX_WAKE (2const).)
The limit value specified via
.I val2
is typically either 1 or
because it would make the
.B FUTEX_CMP_REQUEUE
operation equivalent to
-.BR FUTEX_WAKE .)
+.BR FUTEX_WAKE (2const).)
.IP
The
.B FUTEX_CMP_REQUEUE
and
.B FUTEX_CMP_REQUEUE
can be used to avoid "thundering herd" wake-ups that could occur when using
-.B FUTEX_WAKE
+.BR FUTEX_WAKE (2const)
in cases where all of the waiters that are woken need to acquire
another futex.
Consider the following scenario,
.in
.IP
If a waker thread used
-.BR FUTEX_WAKE ,
+.BR FUTEX_WAKE (2const),
then all waiters waiting on B would be woken up,
and they would all try to acquire lock A.
However, waking all of the threads in this manner would be pointless because
.BR FUTEX_WAKE_BITSET " (since Linux 2.6.25)"
.\" commit cd689985cf49f6ff5c8eddc48d98b9d581d9475d
This operation is the same as
-.B FUTEX_WAKE
+.BR FUTEX_WAKE (2const)
except that the
.I val3
argument is used to provide a 32-bit bit mask to the kernel.
.BR FUTEX_BITSET_MATCH_ANY ;
that is, allow a wake-up by any waker.
The
-.B FUTEX_WAKE
+.BR FUTEX_WAKE (2const)
operation is equivalent to
.B FUTEX_WAKE_BITSET
with
without requeueing on
.I uaddr2
via a
-.B FUTEX_WAKE
+.BR FUTEX_WAKE (2const)
operation in another task.
In this case, the
.B FUTEX_WAIT_REQUEUE_PI
The return value on success depends on the operation,
as described in the following list:
.TP
-.B FUTEX_WAKE
-Returns the number of waiters that were woken up.
-.TP
.B FUTEX_FD
Returns the new file descriptor associated with the futex.
.TP
is invalid.
.TP
.B EINVAL
-.RB ( FUTEX_WAKE ,
-.BR FUTEX_WAKE_OP ,
+.RB ( FUTEX_WAKE_OP ,
.BR FUTEX_WAKE_BITSET ,
.BR FUTEX_REQUEUE ,
.BR FUTEX_CMP_REQUEUE )
--- /dev/null
+.\" Copyright, the authors of the Linux man-pages project
+.\"
+.\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE)
+.\" may be freely modified and distributed
+.\" %%%LICENSE_END
+.\"
+.TH FUTEX_WAKE 2const (date) "Linux man-pages (unreleased)"
+.SH NAME
+FUTEX_WAKE \- wake waiters that are inside FUTEX_WAIT
+.SH LIBRARY
+Standard C library
+.RI ( libc ,\~ \-lc )
+.SH SYNOPSIS
+.nf
+.BR "#include <linux/futex.h>" " /* Definition of " FUTEX_* " constants */"
+.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
+.B #include <unistd.h>
+.P
+.BI "long syscall(SYS_futex, uint32_t *" uaddr ", FUTEX_WAKE, uint32_t " val );
+.fi
+.SH DESCRIPTION
+.TP
+.BR FUTEX_WAKE " (since Linux 2.6.0)"
+.\" Strictly speaking, since Linux 2.5.x
+This operation wakes at most
+.I val
+of the waiters that are waiting (e.g., inside
+.BR FUTEX_WAIT (2const))
+on the futex word at the address
+.IR uaddr .
+Most commonly,
+.I val
+is specified as either 1 (wake up a single waiter) or
+.B INT_MAX
+(wake up all waiters).
+No guarantee is provided about which waiters are awoken
+(e.g., a waiter with a higher scheduling priority is not guaranteed
+to be awoken in preference to a waiter with a lower priority).
+.\" FIXME . (Torvald) I think we should remove this. Or maybe adapt to
+.\" a different example.
+.\"
+.\" For
+.\" .BR futex (7),
+.\" this is executed if incrementing the count showed that
+.\" there were waiters,
+.\" once the futex value has been set to 1
+.\" (indicating that it is available).
+.\"
+.\" How does "incrementing the count show that there were waiters"?
+.\"
+.SH RETURN VALUE
+On error,
+\-1 is returned,
+and
+.I errno
+is set to indicate the error.
+.P
+.B FUTEX_WAKE
+Returns the number of waiters that were woken up.
+.SH ERRORS
+See
+.BR futex (2).
+.TP
+.B EINVAL
+The kernel detected an inconsistency between the user-space state at
+.I uaddr
+and the kernel state\[em]that is, it detected a waiter which waits in
+.B FUTEX_LOCK_PI
+or
+.B FUTEX_LOCK_PI2
+on
+.IR uaddr .
+.SH STANDARDS
+Linux.
+.SH HISTORY
+Linux 2.6.0.
+.SH SEE ALSO
+.BR futex (2)