Skip to content

Commit

Permalink
Merge pull request #56 from rust-embedded/nonsendsync
Browse files Browse the repository at this point in the history
Fix #55, release v1.2.0.
  • Loading branch information
MabezDev authored Oct 16, 2024
2 parents 91e8b9e + 7f8536c commit ed0f84c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

No unreleased changes yet

## [v1.2.0] - 2024-10-16

- Soundness fix: ensure the `CriticalSection` token is not `Send` or `Sync`, so that it can only be used in the thread that acquired it. [#55](https://github.com/rust-embedded/critical-section/issues/55)
- Soundness fix: Fix aliasing `&mut` in the `std` implementation. [#46](https://github.com/rust-embedded/critical-section/pull/46)
- Fix build with `restore-state-usize`. [#50](https://github.com/rust-embedded/critical-section/pull/50)

## [v1.1.3] - 2024-08-22

- Added option to use a `usize` sized restore state
Expand Down Expand Up @@ -123,8 +129,9 @@ If you're seeing a linker error like `undefined symbol: _critical_section_1_0_ac

- First release

[Unreleased]: https://github.com/rust-embedded/critical-section/compare/v1.1.3...HEAD
[v1.1.2]: https://github.com/rust-embedded/critical-section/compare/v1.1.2...v1.1.3
[Unreleased]: https://github.com/rust-embedded/critical-section/compare/v1.2.0...HEAD
[v1.2.0]: https://github.com/rust-embedded/critical-section/compare/v1.1.3...v1.2.0
[v1.1.3]: https://github.com/rust-embedded/critical-section/compare/v1.1.2...v1.1.3
[v1.1.2]: https://github.com/rust-embedded/critical-section/compare/v1.1.1...v1.1.2
[v1.1.1]: https://github.com/rust-embedded/critical-section/compare/v1.1.0...v1.1.1
[v1.1.0]: https://github.com/rust-embedded/critical-section/compare/v1.0.0...v1.1.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "critical-section"
version = "1.1.3"
version = "1.2.0"
edition = "2018"
description = "Cross-platform critical section"
repository = "https://github.com/rust-embedded/critical-section"
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ pub use self::mutex::Mutex;
#[derive(Clone, Copy, Debug)]
pub struct CriticalSection<'cs> {
_private: PhantomData<&'cs ()>,

// Prevent CriticalSection from being Send or Sync
// https://github.com/rust-embedded/critical-section/issues/55
_not_send_sync: PhantomData<*mut ()>,
}

impl<'cs> CriticalSection<'cs> {
Expand All @@ -40,6 +44,7 @@ impl<'cs> CriticalSection<'cs> {
pub unsafe fn new() -> Self {
CriticalSection {
_private: PhantomData,
_not_send_sync: PhantomData,
}
}
}
Expand Down

0 comments on commit ed0f84c

Please sign in to comment.