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
v1.2.0 - 2024-10-16
- Soundness fix: ensure the
CriticalSection
token is notSend
orSync
, so that it can only be used in the thread that acquired it. #55 - Soundness fix: Fix aliasing
&mut
in thestd
implementation. #46 - Fix build with
restore-state-usize
. #50
v1.1.3 - 2024-08-22
- Added option to use a
usize
sized restore state
v1.1.2 - 2023-08-09
- Clarified that
acquire()
must provide ordering guarantees - Updated atomic-polyfill reference to point to portable-atomic instead
- Improved documentation for
Mutex
example - Added list of some known implementations
v1.1.1 - 2022-09-13
- On the
std
implementation, panicking inside thecritical_section::with()
closure no longer accidentally leaves the critical section locked (#26).
v1.1.0 - 2022-08-17
- Added built-in critical section implementation using
std::sync::Mutex
, enabled by thestd
Cargo feature. - MSRV changed to
1.54
whenstd
feature is disabled,1.63
when enabled.
v1.0.0 - 2022-08-10
- Improved docs.
v1.0.0-alpha.2 - 2022-07-28
- Change name of the
extern fn
s to avoid clash with critical-section 0.2.
v1.0.0-alpha.1 - 2022-07-28
Breaking changes:
- Removed all builtin impls. These are going to be provided by platform-support crates now.
- Renamed
custom_impl!
toset_impl!
. - RestoreState is now an opaque struct for the user, and a transparent
RawRestoreState
type alias for impl writers. - RestoreState type is now configurable with Cargo features. Default is
()
. (previously it was fixed tou8
.) - Added own
CriticalSection
andMutex
types, instead of reexporting them frombare_metal
.
v0.2.8 - 2022-11-29
- Implemented critical-section by forwarding to version 1.1.1
Breaking changes:
acquire
andrelease
are only implemented if the restore-state used by version 1.1.1 is an u8 or smaller.- No default critical-section implementation is provided.
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 thecritical-section
dependency toCargo.toml
enabling thestd
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.
v0.2.7 - 2022-04-08
- Add support for AVR targets.
v0.2.6 - 2022-04-02
- Improved docs.
v0.2.5 - 2021-11-02
- Fix
std
implementation to allow reentrant (nested) critical sections. This would previously deadlock.
v0.2.4 - 2021-09-24
- Add support for 32bit RISC-V targets.
v0.2.3 - 2021-09-13
- Use correct
#[vcfg]
forwasm
targets.
v0.2.2 - 2021-09-13
- Added support for
wasm
targets.
v0.2.1 - 2021-05-11
- Added critical section implementation for
std
, based on a global Mutex.
v0.2.0 - 2021-05-10
- Breaking change: use
CriticalSection<'_>
instead of&CriticalSection<'_>
- First release