futex

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Futex

type Futex struct {
	atomic.Uint32
}

A futex is a way for userspace to wait with the pointer as the key, and for another thread to wake one or all waiting threads keyed on the same pointer.

A futex does not change the underlying value, it only reads it before going to sleep (atomically) to prevent lost wake-ups.

func (*Futex) Wait

func (f *Futex) Wait(cmp uint32) bool

Atomically check for cmp to still be equal to the futex value and if so, go to sleep. Return true if we were definitely awoken by a call to Wake or WakeAll, and false if we can't be sure of that.

func (*Futex) WaitUntil

func (f *Futex) WaitUntil(cmp uint32, timeout uint64)

Like Wait, but times out after the number of nanoseconds in timeout.

func (*Futex) Wake

func (f *Futex) Wake()

Wake a single waiter.

func (*Futex) WakeAll

func (f *Futex) WakeAll()

Wake all waiters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL