Expand description
§hazard3-sync
Published replacement:
hazard3-syncreplaces the formerly publishedembassy-sync-riscv. See the project repository for the publication status of the Hazard3 packages. Upstream license and attribution notices are retained.
Unofficial, RISC-V-first fork.
hazard3-syncis an independent fork ofembassy-synctaken from the Embassymainbranch, maintained by Jorge Andre Castro at https://github.com/jorgeandrecastro/Hazard3. It was originally republished under another name becausehazard3-rpneeds the unreleased changes ofmain, and crates.io does not accept git dependencies. Addhazard3-syncdirectly in Cargo.toml and import it ashazard3_sync. Use thehazard3-*versions of the forked crates together (hazard3-time,hazard3-executor,hazard3-sync, …) to avoid duplicate/incompatible copies in your build.
Synchronization primitives and data structures with async support:
Channel- A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer.PriorityChannel- A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer. Higher priority items are shifted to the front of the channel.PubSubChannel- A broadcast channel (publish-subscribe) channel. Each message is received by all consumers.Signal- Signalling latest value to a single consumer.Watch- Signalling latest value to multiple consumers.Mutex- Mutex for synchronizing state between asynchronous tasks.Pipe- Byte stream implementingembedded_iotraits.WakerRegistration- Utility to register and wake aWaker.AtomicWaker- Utility to register and wake aWakerfrom interrupt context.MultiWakerRegistration- Utility registering and waking multipleWaker’s.LazyLock- A value which is initialized on the first access
§Migration to 0.3.0
The Rust library is now hazard3_sync instead of embassy_sync. Update imports and macro paths; this is a source-breaking change. Add the package directly without a package alias:
[dependencies]
hazard3-sync = "0.3"Use compatible versions of the other Hazard3 crates together; older releases may use different library names.
§Interoperability
Futures from this crate can run on any executor.
§Acknowledgements
This crate is part of Hazard3, an unofficial, independent RISC-V-first fork of the
Embassy project. Credit for the original work remains
with Embassy and its contributors. The original MIT OR Apache-2.0 terms and copyright notices
are retained (see LICENSE-MIT and LICENSE-APACHE). Hazard3 is not affiliated with or
endorsed by Embassy.
Thank you to the Embassy team and contributors for their work.
Modules§
- blocking_
mutex - Blocking mutex.
- channel
- A queue for sending values between asynchronous tasks.
- lazy_
lock - Synchronization primitive for initializing a value once, allowing others to get a reference to the value.
- mutex
- Async mutex.
- once_
lock - Synchronization primitive for initializing a value once, allowing others to await a reference to the value.
- pipe
- Async byte stream pipe.
- priority_
channel - A queue for sending values between asynchronous tasks.
- pubsub
- Implementation of PubSubChannel, a queue where published messages get received by all subscribers.
- rpc_
service - Async interface for dispatching
FnOnce(&mut T) -> Rjobs to a dedicated runner task with exclusive access toT. - rwlock
- Async read-write lock.
- semaphore
- A synchronization primitive for controlling access to a pool of resources.
- signal
- A synchronization primitive for passing the latest value to a task.
- waitqueue
- Async low-level wait queues
- watch
- A synchronization primitive for passing the latest value to multiple receivers.
- zerocopy_
channel - A zero-copy queue for sending values between asynchronous tasks.