Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace depreciated atomic-polyfill crate with portable-atomic #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ 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).

## 1.0.2 - 2024-09-11

- Replace depreciated `atomic-polyfill` crate with `portable-atomic`.
ImTheSquid marked this conversation as resolved.
Show resolved Hide resolved

## 1.0.1 - 2022-12-11

- Use `atomic-polyfill`, to support targets without atomic CAS.
Expand Down
11 changes: 3 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
[package]
name = "atomic-pool"
version = "1.0.1"
version = "1.0.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 2.0.0, since this is a breaking change.

authors = ["Dario Nieuwenhuis <[email protected]>"]
description = "Statically allocated pool providing a std-like Box."
repository = "https://github.com/embassy-rs/atomic-pool"
edition = "2021"
readme = "README.md"
license = "MIT OR Apache-2.0"
categories = [
"embedded",
"no-std",
"concurrency",
"memory-management",
]
categories = ["embedded", "no-std", "concurrency", "memory-management"]

[dependencies]
atomic-polyfill = "1.0"
as-slice-01 = { package = "as-slice", version = "0.1.5" }
as-slice-02 = { package = "as-slice", version = "0.2.1" }
portable-atomic = { version = "1.7.0", features = ["critical-section"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not unconditionally enable critical-section, the user might want to use unsafe-assume-single-core instead which is slightly faster in single-core chips.

I'd add two features that forward to portable-atomic:

[features]
portable-atomic-critical-section = ["portable-atomic/critical-section"]
portable-atomic-unsafe-assume-single-core = ["portable-atomic/unsafe-assume-single-core"]

stable_deref_trait = { version = "1.2.0", default-features = false }
2 changes: 1 addition & 1 deletion src/atomic_bitset.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use atomic_polyfill::{AtomicU32, Ordering};
use portable_atomic::{AtomicU32, Ordering};

pub struct AtomicBitset<const N: usize, const K: usize>
where
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

mod atomic_bitset;

use atomic_polyfill::AtomicU32;
use core::cell::UnsafeCell;
use core::hash::{Hash, Hasher};
use core::mem::MaybeUninit;
use core::ops::{Deref, DerefMut};
use core::{cmp, mem, ptr::NonNull};
use portable_atomic::AtomicU32;

use crate::atomic_bitset::AtomicBitset;

Expand Down
Loading