Skip to main content

Module wake

Module wake 

Source
Expand description

Phase 130 — ergonomic Rust wrapper around PlatformThreading’s wake primitive.

Wraps a fixed-size, aligned scratch buffer so the executor can drop a PlatformWake<P> into a struct field without having to call nros_platform_wake_storage_size() at compile time. WAKE_STORAGE_BYTES is sized to cover every supported platform’s binary semaphore (POSIX sem_t ~32 B, Zephyr k_sem ~16 B, FreeRTOS xSemaphoreHandle ~ptr, NuttX sem_t, ThreadX tx_semaphore ~56 B, macOS pthread cond+mutex+flag ~72 B). The probe-vs-buffer invariant is asserted at runtime during construction.

Allocation-free: Wake<P> lives inline. Suitable for no_std consumers that can’t depend on alloc.

Wake<P> is Sync (the underlying primitive is the wake contract) but not Send after construction — the storage must stay put because the platform impl stores backing-primitive pointers that reference it.

Structs§

Wake
RAII wrapper around the platform’s wake primitive.

Enums§

WakeInitError
Errors at construction time.
WakeReason
Reason wait_ms returned.

Constants§

WAKE_STORAGE_ALIGN
Alignment of the inline storage buffer. Wide enough for every pointer-aligned primitive on 64-bit hosts.
WAKE_STORAGE_BYTES
Maximum bytes the wake primitive may occupy on any supported platform. Sized generously so we never have to bump for a new RTOS port. Asserted against the runtime probe in Wake::new.