---
title: "futex_wake()"
description: "Wakes up one thread that is blocked on a futex_wait() operation on the specified futex."
url: "https://wasix.org/docs/api-reference/wasix/futex_wake/"
markdown: "https://wasix.org/docs/api-reference/wasix/futex_wake.md"
---

# `futex_wake()`

Wakes up one thread that is blocked on a `futex_wait()` operation on the specified futex.

## Description

The `futex_wake()` function wakes up one thread that is waiting on the specified futex. It returns `true` if a thread was successfully woken up, or `false` if no thread was waiting on the futex.

## Syntax

```ebnf
  ;;; or false if no thread was waiting on this futex.
  ;;; Returns true if this actually woke up such a thread,
  ;;;
  ;;; Wake up one thread that's blocked on futex_wait on this futex.
  (@interface func (export "futex_wake")
    ;;; 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 a thread was 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()` function is used to wake up a thread that is blocked on a `futex_wait()` operation.
- It takes a pointer to the memory location holding the futex as the `futex_ptr` parameter.
- If a thread is waiting on the specified futex, `futex_wake()` wakes up one thread and returns `true`. If no thread is waiting on the futex, it returns `false`.
- The `ret_woken` parameter is a pointer to a Boolean value that indicates whether a thread was woken up. If `true`, it means a thread was woken up. If `false`, it means no thread was waiting on the futex.
- The behavior and limitations of the `futex_wake()` 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/)
