All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
No unreleased changes yet
acquire()
must provide ordering guaranteesMutex
examplestd
implementation, panicking inside the critical_section::with()
closure no longer accidentally leaves the critical section locked (#26).std::sync::Mutex
, enabled by the std
Cargo feature.1.54
when std
feature is disabled, 1.63
when enabled.extern fn
s to avoid clash with critical-section 0.2.Breaking changes:
custom_impl!
to set_impl!
.RawRestoreState
type alias for impl writers.()
. (previously it was fixed to u8
.)CriticalSection
and Mutex
types, instead of reexporting them from bare_metal
.Breaking changes:
acquire
and release
are only implemented if the restore-state used by version 1.1.1 is an u8 or smaller.Those breaking changes are necessary because versions <= 0.2.7 were unsound, and that was impossible to fix without a breaking change.
This version is meant to minimize that breaking change. However, all users are encouraged to upgrade to critical-section 1.1.
If you‘re seeing a linker error like undefined symbol: _critical_section_1_0_acquire
, you’re affected. To fix it:
If your target supports std
: Add the critical-section
dependency to Cargo.toml
enabling the std
feature.
[dependencies] critical-section = { version = "1.1", features = ["std"]}
For single-core Cortex-M targets in privileged mode:
[dependencies] cortex-m = { version = "0.7.6", features = ["critical-section-single-core"]}
For single-hart RISC-V targets in privileged mode:
[dependencies] riscv = { version = "0.10", features = ["critical-section-single-hart"]}
For other targets: check if your HAL or architecture-support crate has a critical-section 1.0
implementation available. Otherwise, provide your own.
std
implementation to allow reentrant (nested) critical sections. This would previously deadlock.#[vcfg]
for wasm
targets.wasm
targets.std
, based on a global Mutex.CriticalSection<'_>
instead of &CriticalSection<'_>