futex_wake_all()
Wakes up all threads that are blocked on a futex_wait()
operation on the specified futex.
Description
The futex_wake_all()
function wakes up all threads that are waiting on the specified futex. It returns true
if one or more threads were successfully woken up, or false
if no threads were waiting on the futex.
Syntax
;;; Wake up all threads that are waiting on futex_wait on this futex.
(@interface func (export "futex_wake_all")
;;; Memory location that holds a futex that others may be waiting on
(param $futex (@witx pointer u32))
(result $error (expected $bool (error $errno)))
)
Parameters
ctx
: A mutable reference to the function environment.futex_ptr
: A pointer to the memory location holding the futex.ret_woken
: A pointer to a Boolean value that will be set totrue
if one or more threads were woken up, orfalse
otherwise.
Return Value
The function returns an Errno
value indicating the outcome of the operation. If the operation is successful, Errno::Success
is returned. If an error occurs, an appropriate Errno
value is returned.
Notes
- The
futex_wake_all()
function is used to wake up all threads that are blocked on afutex_wait()
operation. - It takes a pointer to the memory location holding the futex as the
futex_ptr
parameter. - If one or more threads are waiting on the specified futex,
futex_wake_all()
wakes up all of them and returnstrue
. If no threads are waiting on the futex, it returnsfalse
. - The
ret_woken
parameter is a pointer to a Boolean value that indicates whether one or more threads were woken up. Iftrue
, it means one or more threads were woken up. Iffalse
, it means no threads were waiting on the futex. - The behavior and limitations of the
futex_wake_all()
function may vary depending on the specific runtime environment and underlying operating system. It is important to consult the documentation or specifications of the specific environment to understand its behavior in that context.