---
title: "futex_wake_all()"
description: "Wakes up all threads that are blocked on a futex_wait() operation on the specified futex."
url: "https://wasix.org/docs/api-reference/wasix/futex_wake_all/"
markdown: "https://wasix.org/docs/api-reference/wasix/futex_wake_all.md"
---

# `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

```ebnf
  ;;; 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 to `true` if one or more threads were woken up, or `false` 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 a `futex_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 returns `true`. If no threads are waiting on the futex, it returns `false`.
- The `ret_woken` parameter is a pointer to a Boolean value that indicates whether one or more threads were woken up. If `true`, it means one or more threads were woken up. If `false`, 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.

---

[Documentation index](https://wasix.org/llms.txt) · [HTML version](https://wasix.org/docs/api-reference/wasix/futex_wake_all/)
