# hazard3-sync
> **Published replacement:** `hazard3-sync` replaces the formerly published `embassy-sync-riscv`.
> See the project repository for the publication status of the Hazard3 packages.
> Upstream license and attribution notices are retained.
[](https://crates.io/crates/hazard3-sync)
[](https://docs.rs/hazard3-sync)
[](https://opensource.org/licenses/MIT)
> **Unofficial, RISC-V-first fork.** `hazard3-sync` is an independent fork of [`embassy-sync`](https://github.com/embassy-rs/embassy/tree/main/embassy-sync)
> taken from the Embassy `main` branch, maintained by [Jorge Andre Castro](https://github.com/jorgeandrecastro) at
> <https://github.com/jorgeandrecastro/Hazard3>. It was originally republished under another name because [`hazard3-rp`](https://crates.io/crates/hazard3-rp)
> needs the unreleased changes of `main`, and crates.io does not accept git dependencies.
> Add `hazard3-sync` directly in Cargo.toml and import it as `hazard3_sync`.
> **Use the `hazard3-*` 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`](channel::Channel) - A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer.
- [`PriorityChannel`](priority_channel::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`](pubsub::PubSubChannel) - A broadcast channel (publish-subscribe) channel. Each message is received by all consumers.
- [`Signal`](signal::Signal) - Signalling latest value to a single consumer.
- [`Watch`](watch::Watch) - Signalling latest value to multiple consumers.
- [`Mutex`](mutex::Mutex) - Mutex for synchronizing state between asynchronous tasks.
- [`Pipe`](pipe::Pipe) - Byte stream implementing `embedded_io` traits.
- [`WakerRegistration`](waitqueue::WakerRegistration) - Utility to register and wake a `Waker`.
- [`AtomicWaker`](waitqueue::AtomicWaker) - Utility to register and wake a `Waker` from interrupt context.
- [`MultiWakerRegistration`](waitqueue::MultiWakerRegistration) - Utility registering and waking multiple `Waker`'s.
- [`LazyLock`](lazy_lock::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:
```toml
[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](https://github.com/embassy-rs/embassy). 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.