Skip to main content

Module sync

Module sync 

Source
Expand description

Synchronization primitives abstraction

This module provides a unified interface for different mutex implementations, allowing the transport layer to work with various executor backends.

All backends expose a single API: Mutex::with(), which executes a closure while holding the lock. This closure-based API guarantees correct lock release across all backends (spin, critical-section, no-sync).

§Feature Flags

  • sync-spin (default for zenoh): Uses spin::Mutex - works everywhere but not RTIC-compatible
  • sync-critical-section: Uses critical sections - RTIC/Embassy compatible
  • sync-portable-atomic: Uses portable-atomic for broader platform support

§RTIC Compatibility

For RTIC applications, use sync-critical-section feature. This ensures that mutex operations use critical_section::with() which is compatible with RTIC’s Stack Resource Policy (SRP) scheduling.

Modules§

atomic
Helper functions for atomic operations used in buffers

Structs§

Mutex
Mutex without synchronization (single-threaded only)