diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c3c8f9..30a782d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.1] - 2021-11-09 + +### Fixed + +* Memory orderings for aquireing and releasing BSEC have been slightly relaxed. +* Memory orderings for the `FakeClock` (only used in tests) have been relaxed. + + ## [0.3.0] - 2021-05-15 ### Added @@ -40,8 +48,9 @@ Try to get documentation to build on docs.rs. Initial release. -[Unreleased]: https://github.com/jgosmann/bsec/compare/v0.3.0...HEAD -[0.3.0]: https://github.com/jgosmann/bsec/compare/v0.3.0...v0.3.0 +[Unreleased]: https://github.com/jgosmann/bsec/compare/v0.3.1...HEAD +[0.3.0]: https://github.com/jgosmann/bsec/compare/v0.3.0...v0.3.1 +[0.3.0]: https://github.com/jgosmann/bsec/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/jgosmann/bsec/compare/v0.1.2...v0.2.0 [0.1.2]: https://github.com/jgosmann/bsec/compare/v0.1.1...v0.1.2 [0.1.1]: https://github.com/jgosmann/bsec/compare/v0.1.0...v0.1.1 diff --git a/Cargo.toml b/Cargo.toml index 421c73a..5d92940 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,20 @@ [package] -name = "bsec" -version = "0.3.0" authors = ["Jan Gosmann "] +categories = ["embedded"] +description = "Rust API to the Bosch BSEC library." edition = "2018" +keywords = ["bindings", "bsec"] license = "MIT OR Apache-2.0" -description = "Rust API to the Bosch BSEC library." -repository = "https://github.com/jgosmann/bsec" +name = "bsec" readme = "README.md" -keywords = ["bindings", "bsec"] -categories = ["embedded"] +repository = "https://github.com/jgosmann/bsec" +version = "0.3.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bme680 = { version = "0.5.1", optional = true } -embedded-hal = { version = "0.2.5", optional = true } +bme680 = {version = "0.5.1", optional = true} +embedded-hal = {version = "0.2.5", optional = true} libalgobsec-sys = "0.1.0" nb = "1.0.0" diff --git a/src/clock.rs b/src/clock.rs index b3a08f5..43353bf 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -80,7 +80,10 @@ pub mod tests { /// This module is only available if the **test-support** feature is enabled. #[cfg(any(test, feature = "test-support"))] pub mod test_support { - use std::{sync::atomic::{AtomicI64, Ordering}, time::Duration}; + use std::{ + sync::atomic::{AtomicI64, Ordering}, + time::Duration, + }; use super::*; @@ -114,14 +117,15 @@ pub mod test_support { impl Clock for FakeClock { /// Returns the current timestamp and advances it by one. fn timestamp_ns(&self) -> i64 { - self.timestamp_ns.fetch_add(1, Ordering::AcqRel) + self.timestamp_ns.fetch_add(1, Ordering::Relaxed) } } impl FakeClock { /// Advance the clock's internal time by `duration`. pub fn advance_by(&self, duration: Duration) { - self.timestamp_ns.fetch_add(duration.as_nanos() as i64, Ordering::AcqRel); + self.timestamp_ns + .fetch_add(duration.as_nanos() as i64, Ordering::Relaxed); } } } diff --git a/src/lib.rs b/src/lib.rs index 325d7e1..7a40518 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -229,7 +229,7 @@ impl> Bsec { /// * `clock`: [`Clock`] implementation to obtain timestamps. pub fn init(bme: S, clock: B) -> Result> { if BSEC_IN_USE - .compare_exchange(false, true, Ordering::AcqRel, Ordering::Relaxed) + .compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) .is_ok() { unsafe { @@ -479,7 +479,7 @@ impl> Bsec { impl> Drop for Bsec { fn drop(&mut self) { - BSEC_IN_USE.store(false, Ordering::SeqCst); + BSEC_IN_USE.store(false, Ordering::Release); } }