Skip to content

Commit

Permalink
Fix: Implement Send/Sync for FixedBitset (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
james7132 authored Mar 22, 2024
1 parent d1fa2dc commit ca4dd26
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit ca4dd26

Please sign in to comment.