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

Fix: Implement Send/Sync for FixedBitset #124

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "fixedbitset"
version = "0.5.5"
version = "0.5.6"
authors = ["bluss"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -10,12 +10,16 @@ Please read the [API documentation here](https://docs.rs/fixedbitset/)

# Recent Changes

- 0.5.5
- 0.5.6
- Fixed FixedBitset not implementing Send/Sync due to the stack size shrink.
- 0.5.5 (yanked)
- [#116](https://github.com/petgraph/fixedbitset/pull/116): Add functions for counting the results of a set operation (`union_count`,
`intersection_count`, `difference_count`, `symmetric_difference_count`) by @james7132.
- [#118](https://github.com/petgraph/fixedbitset/pull/118): Shrink the stack size of FixedBitset. There should be zero stack size overhead
compared to a Vec.
- [#119](https://github.com/petgraph/fixedbitset/pull/119): Fix builds for wasm32.
- [#120](https://github.com/petgraph/fixedbitset/pull/119): Add more utility functions that were previously missing from the public interface:
`contains_any_in_range`, `contains_all_in_range`, `minimum`, `maximum`, `is_full`, `count_zeroes`, and `remove_range`.
- [#121](https://github.com/petgraph/fixedbitset/pull/121): Add support for SIMD acceleration for AVX builds.
- 0.5.4
- [#112](https://github.com/petgraph/fixedbitset/pull/112): Fix undefined behavior in IntoOnes and setup testing with MIRI by @SkiFire13
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Expand Up @@ -76,6 +76,12 @@ pub struct FixedBitSet {
pub(crate) length: usize,
}

// SAFETY: FixedBitset contains no thread-local state and can be safely sent between threads
unsafe impl Send for FixedBitSet {}
// SAFETY: FixedBitset does not provide simultaneous unsynchronized mutable access to the
// underlying buffer.
unsafe impl Sync for FixedBitSet {}

impl FixedBitSet {
/// Create a new empty **FixedBitSet**.
pub const fn new() -> Self {
Expand Down