API reference Dodo 0.1.4

std/sync

Public declarations, types, methods, and source contracts for std/sync.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/sync"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
error std/sync/error sync.dodo
mem core/mem sync.dodo
native std/sync/native sync.dodo
ptr core/ptr sync.dodo
time std/time sync.dodo

forever

Function · Source

All waits take a relative monotonic millisecond budget. Zero is a try operation. Saturation is explicit: forever() is the sole infinite sentinel.

pub fn forever() -> u64

milliseconds

Function · Source

pub fn milliseconds(duration: &time.Duration) -> u64!error.Error

Storage

Struct · Source

Storage is caller-owned and cannot move while an initialized owner exists. The C boundary checks actual target size and alignment at initialization.

pub struct Storage {
    // Private implementation fields omitted.
}

Storage.new

Function · Source

pub fn new() -> Storage

Mutex

Struct · Source

pub struct Mutex<T> {
    // Private implementation fields omitted.
}

Mutex.new

Function · Source

pub fn new(storage: &mut Storage, value: T) -> Mutex<T>!error.Error from(storage)

Mutex.lock

Function · Source

pub fn lock(&self, timeout: u64) -> Guard<T>!error.Error from(self)

Mutex.notify_one

Function · Source

pub fn notify_one(&self)

Mutex.notify_all

Function · Source

pub fn notify_all(&self)

Mutex.cancel

Function · Source

pub fn cancel(&self)

Mutex.condition

Function · Source

pub fn condition(&self) -> ConditionVariable<T> from(self)

Guard

Struct · Source

Guards are thread-affine and unlock deterministically on all normal exits. Checked views borrow the guard itself, preventing unlock/wait while in use.

pub struct Guard<T> {
    // Private implementation fields omitted.
}

Guard.get

Function · Source

pub fn get(&self) -> &T from(self)

Guard.get_mut

Function · Source

pub fn get_mut(&mut self) -> &mut T from(self)

Guard.wait

Function · Source

pub fn wait(&mut self, timeout: u64) -> void!error.Error

ConditionVariable

Struct · Source

Permanently bound to a single mutex: using concurrent waits with a different native mutex can never violate the OS condition-variable contract.

pub struct ConditionVariable<T> {
    // Private implementation fields omitted.
}

ConditionVariable.wait

Function · Source

pub fn wait(&self, guard: &mut Guard<T>, timeout: u64) -> void!error.Error

ConditionVariable.notify_one

Function · Source

pub fn notify_one(&self)

ConditionVariable.notify_all

Function · Source

pub fn notify_all(&self)

RwLock

Struct · Source

pub struct RwLock<T> {
    // Private implementation fields omitted.
}

RwLock.new

Function · Source

pub fn new(storage: &mut Storage, value: T) -> RwLock<T>!error.Error from(storage)

RwLock.read

Function · Source

pub fn read(&self, timeout: u64) -> ReadGuard<T>!error.Error from(self)

RwLock.write

Function · Source

pub fn write(&self, timeout: u64) -> WriteGuard<T>!error.Error from(self)

RwLock.cancel

Function · Source

pub fn cancel(&self)

ReadGuard

Struct · Source

pub struct ReadGuard<T> {
    // Private implementation fields omitted.
}

ReadGuard.get

Function · Source

pub fn get(&self) -> &T from(self)

WriteGuard

Struct · Source

pub struct WriteGuard<T> {
    // Private implementation fields omitted.
}

WriteGuard.get

Function · Source

pub fn get(&self) -> &T from(self)

WriteGuard.get_mut

Function · Source

pub fn get_mut(&mut self) -> &mut T from(self)

Barrier

Struct · Source

pub struct Barrier {
    // Private implementation fields omitted.
}

Barrier.new

Function · Source

pub fn new(storage: &mut Storage, parties: usize) -> Barrier!error.Error from(storage)

Barrier.wait

Function · Source

pub fn wait(&self, timeout: u64) -> void!error.Error

Barrier.cancel

Function · Source

pub fn cancel(&self)

Channel

Struct · Source

A fixed ring owns initialized messages in caller-provided opaque slots. Closing rejects senders, wakes waiters, and leaves buffered messages drainable.

pub struct Channel<T> {
    // Private implementation fields omitted.
}

Channel.new

Function · Source

pub fn new(storage: &mut Storage, slots: &mut[MaybeUninit<T>]) -> Channel<T>!error.Error from(storage, slots)

Channel.send

Function · Source

pub fn send(&self, value: T, timeout: u64) -> void!error.Error

Channel.receive

Function · Source

pub fn receive(&self, timeout: u64) -> Option<T>!error.Error

Channel.close

Function · Source

pub fn close(&self)

Channel.cancel

Function · Source

pub fn cancel(&self)

Once

Struct · Source

Initialization is serialized by the mutex. A fallible initializer leaves None on failure and may be retried; aborting traps never unwind or poison.

pub struct Once<T> {
    // Private implementation fields omitted.
}

Once.new

Function · Source

pub fn new(storage: &mut Storage) -> Once<T>!error.Error from(storage)

Once.get_or_init

Function · Source

pub fn get_or_init<I>(&self, initializer: &mut I, timeout: u64) -> OnceGuard<T>!error.Error from(self)

OnceGuard

Struct · Source

pub struct OnceGuard<T> {
    // Private implementation fields omitted.
}

OnceGuard.get

Function · Source

Successful initialization always contains Some. Read-only access keeps callers from resetting the state and rerunning a completed initializer.

pub fn get(&self) -> &Option<T> from(self)

Type to search all documentation.

Keyboard shortcuts

Search documentation
Ctrl K or /
Move through results
↑ ↓
Open selected result
Enter
Close a dialog
Esc
Show these shortcuts
?