mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 21:05:35 +01:00
Each mutex is generated uniquely for each task, it is unsound to send them between tasks. But they are `Send`. Before, it wasn't an issue, because you couldn't share non-`'static` data between them, but with \#1043 you can make the mutex `'static`. Thus we need to use actual tools that Rust provides and out out from `Send`. Currently, mutexes are simple ZSTs with `PhantomData<&'a ()>`, which is `Send`. We replace it with `PhantomData<(&'a (), *const u8)>`, and return `Sync` back via `unsafe` implementation. It is trivially sound, because mutexes have no method methods that accept `&self`. See https://doc.rust-lang.org/std/sync/struct.Exclusive.html for details. |
||
|---|---|---|
| .. | ||
| src | ||
| tests | ||
| ui | ||
| .gitignore | ||
| Cargo.toml | ||
| CHANGELOG.md | ||