diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -94,15 +94,21 @@ The crate comes with a few feature flags that you may wish to use. - `portable_atomic` enables usage of the `portable-atomic` crate to support platforms without native atomic operations (Cortex-M0, etc.). - The `portable_atomic_unsafe_assume_single_core` cfg flag - must also be set by the final binary crate. - This can be done by adapting the following snippet to the `.cargo/config` file: + The `portable_atomic_unsafe_assume_single_core` cfg or `critical-section` feature + of `portable-atomic` crate must also be set by the final binary crate. + + When using the cfg, this can be done by adapting the following snippet to the `.cargo/config` file: ``` [target.<target>] rustflags = [ "--cfg", "portable_atomic_unsafe_assume_single_core" ] ``` Note that this cfg is unsafe by nature, and enabling it for multicore systems is unsound. + When using the `critical-section` feature, you need to implement the critical-section + implementation that sound for your system by implementing an unsafe trait. + See [the documentation for the `portable-atomic` crate](https://docs.rs/portable-atomic/latest/portable_atomic/#optional-cfg) + for more information. + ## Remarks It is often desirable to have a lock shared between threads. Wrapping the lock in an |