rustix::thread

Module futex

source
Expand description

Linux futex.

Futex is a very low-level mechanism for implementing concurrency primitives such as mutexes, rwlocks, and condvars.

§Examples

use rustix::thread::futex;
use std::sync::atomic::AtomicU32;

// Wake up one waiter.
futex::wake(futex, futex::Flags::PRIVATE, 1)?;

§References

Structs§

  • FUTEX_* flags for use with the functions in futex.

Enums§

Constants§

Functions§

  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_CMP_REQUEUE, val, val2, uaddr2, val3)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_CMP_REQUEUE_PI, 1, val2, uaddr2, val3)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_FD, val, NULL, NULL, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_LOCK_PI, 0, timeout, NULL, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_LOCK_PI2, 0, timeout, NULL, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_REQUEUE, val, val2, uaddr2, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_TRYLOCK_PI, 0, NULL, NULL, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_UNLOCK_PI, 0, NULL, NULL, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_WAIT, val, timeout, NULL, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_WAIT_BITSET, val, timeout, NULL, val3)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_WAIT_REQUEUE_PI, val, timeout, uaddr2, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_WAKE, val, NULL, NULL, 0)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_WAKE_BITSET, val, NULL, NULL, val3)
  • Equivalent to syscall(SYS_futex, uaddr, FUTEX_WAKE_OP, val, val2, uaddr2, val3)

Type Aliases§