Commit Graph

90 Commits

Author SHA1 Message Date
John Nunley e874f701f8
v2.5.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-04-26 07:25:42 -07:00
John Nunley 5b74dc8acc
Merge fetch_and andthe prev_value check
cc https://github.com/smol-rs/concurrent-queue/pull/58#discussion_r1574686897

Signed-off-by: John Nunley <dev@notgull.net>
2024-04-25 22:53:55 -07:00
John Nunley 05e7bff8e5
tests: Add more tests for force_push
This commit adds more tests for the force_push functionality. These
tests are copied from the corresponding crossbeam implementation.

We also add a clone of the "spsc" test that uses force_push.

Signed-off-by: John Nunley <dev@notgull.net>
2024-04-22 19:01:51 -07:00
John Nunley 576965a8a5 tests: Move test to bounded.rs
Previously the force_push test was placed in unbounded.rs by accident

Signed-off-by: John Nunley <dev@notgull.net>
2024-04-13 23:40:59 -07:00
James Liu 89a64f8c3b
feat: Make unbounded a const function
This PR makes `ConcurrentQueue::unbounded` a const function. It'd be great if `bounded` could be `const` as well, but this would likely require static memory allocation support in const functions, which is currently not allowed by the compiler. This would enable https://github.com/smol-rs/async-executor/pull/112 to be directly constructable in a const context (i.e. static/thread_local variable initialization without OnceLock). It might also allow unbounded `async_channel`s to be constructed in a similar context.

Co-authored-by: Taiki Endo <te316e89@gmail.com>
2024-04-13 09:01:26 -07:00
John Nunley 59e93fc952
ci: Test loom under no-default-features
This commit adds loom tests to CI with --no-default-features, then also
fixes a compile error that was introduced in a new version of loom.

Closes #64
2024-03-31 11:09:52 -07:00
John Nunley c407467c20
feat: Add an overflow push method
In some cases it is desired to have a "lossy" queue for data. Such as an
event queue where more recent events should be prioritized over older
ones, where infinite storage is impractical. This commit adds a method
called "force_push" which enables this usage.

Bounded queue code is partially derived from the following commit:
bd75c3c45e

cc smol-rs/async-channel#44
2024-03-30 16:38:05 -07:00
John Nunley ff53a68d8c ci: Add loom test to CI
I'm unsure why this wasn't added to begin with. This adds Loom testing
to the CI with a low number of max pre-emptions, in order to avoid
making the test take forever.

cc https://github.com/smol-rs/event-listener/pull/126#issue-2214269916

Signed-off-by: John Nunley <dev@notgull.net>
2024-03-30 07:40:49 -07:00
Taiki Endo d49453323c Remove dead code
```
error: method `with` is never used
  --> src/sync.rs:65:12
   |
62 |     pub(crate) trait UnsafeCellExt {
   |                      ------------- method in this trait
...
65 |         fn with<R, F>(&self, f: F) -> R
   |            ^^^^
   |
   = note: `-D dead-code` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(dead_code)]`
```
2024-03-06 02:19:43 +09:00
Taiki Endo 93ee058b7f Migrate to Rust 2021 2024-01-07 01:57:36 +09:00
Taiki Endo e7c2115f62 Relax MSRV to 1.60
https://github.com/crossbeam-rs/crossbeam/pull/1056
2024-01-07 01:57:36 +09:00
Taiki Endo 9f6f5d3188 ci: Use cargo-hack's --rust-version flag for msrv check
This respects rust-version field in Cargo.toml, so it removes the need
to manage MSRV in both the CI file and Cargo.toml.
2024-01-07 01:57:36 +09:00
dependabot[bot] 3b08720796
Update criterion requirement from 0.4.0 to 0.5 (#42)
Signed-off-by: dependabot[bot] <support@github.com>
2024-01-07 01:51:40 +09:00
John Nunley 71302ab09c
tests: Add WASM testing
This commit ensures this crate builds and works on WASM.

Signed-off-by: John Nunley <dev@notgull.net>
2023-12-16 11:20:15 -08:00
John Nunley 79b9292d10
m: Bump MSRV to 1.61
Due to crossbeam-rs/crossbeam#1037

Signed-off-by: John Nunley <dev@notgull.net>
2023-12-16 09:04:58 -08:00
John Nunley ba51f6e942
v2.4.0
Signed-off-by: John Nunley <dev@notgull.net>
2023-12-02 10:59:27 -08:00
Irine c0e1098aa0
bugfix: Remove the heap allocation from non-single queues 2023-11-15 18:08:17 -08:00
John Nunley 22b5e83c4f
v2.3.0
Signed-off-by: John Nunley <dev@notgull.net>
2023-09-25 10:22:00 -07:00
Taiki Endo 381d6360e1 Update actions/checkout action to v4 2023-09-10 18:25:36 +09:00
MrEconomical 04f3a1eecc
feat: Implement UnwindSafe on core (#49) 2023-08-25 21:15:31 +09:00
Taiki Endo cbdf9e88e1
bugfix: Use inline assembly in full_fence
This commit bumps the MSRV to 1.59
2023-08-13 14:33:40 -07:00
dependabot[bot] 2d309371f8
deps: Update loom requirement from 0.6 to 0.7
Updates the requirements on [loom](https://github.com/tokio-rs/loom) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/loom/releases)
- [Changelog](https://github.com/tokio-rs/loom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/loom/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: loom
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-07 16:33:30 -07:00
John Nunley b660d795a4
Add smol-rs logo (#45) 2023-07-17 14:33:21 +09:00
dependabot[bot] c1d2c77b1c Update loom requirement from 0.5 to 0.6
Updates the requirements on [loom](https://github.com/tokio-rs/loom) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/loom/releases)
- [Changelog](https://github.com/tokio-rs/loom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/loom/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: loom
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-04 12:24:37 +09:00
dependabot[bot] 2cd3dbad14 Update fastrand requirement from 1.3.3 to 2.0.0
Updates the requirements on [fastrand](https://github.com/smol-rs/fastrand) to permit the latest version.
- [Release notes](https://github.com/smol-rs/fastrand/releases)
- [Changelog](https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/fastrand/compare/v1.3.3...v2.0.0)

---
updated-dependencies:
- dependency-name: fastrand
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-11 16:08:55 +09:00
John Nunley e3fef3f0ae
v2.2.0 (#38) 2023-04-07 10:53:32 -07:00
Taiki Endo 07c3e4d5b9 Minimize GITHUB_TOKEN permissions
Refs: https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token
2023-03-26 16:30:28 +09:00
Taiki Endo d66e007b3a Set CARGO_NET_GIT_FETCH_WITH_CLI=true in CI 2023-03-26 16:30:05 +09:00
John Nunley f877490dcb
feat: Add the try_iter method (#36) 2023-03-06 19:22:48 -08:00
Taiki Endo a96abb3467 Release 2.1.0 2023-01-15 23:36:42 +09:00
Taiki Endo db25fe1573 Update CI config 2023-01-15 23:36:42 +09:00
Taiki Endo b5463b2f5e Update portable-atomic to 1.0 2023-01-15 23:14:59 +09:00
dependabot[bot] 54e7d94998 Update criterion requirement from 0.3.4 to 0.4.0
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Release notes](https://github.com/bheisler/criterion.rs/releases)
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.3.4...0.4.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-28 12:42:51 +09:00
Taiki Endo 3383b2125a Enable dependabot update for Rust 2022-12-28 12:26:33 +09:00
Taiki Endo 1ff6001c68 Clean up CI config 2022-12-28 12:26:33 +09:00
Taiki Endo 6be67b375d Fix clippy::bool_to_int_with_if warning
```
warning: boolean to int conversion using if
  --> src/single.rs:93:9
   |
93 | /         if self.state.load(Ordering::SeqCst) & PUSHED == 0 {
94 | |             0
95 | |         } else {
96 | |             1
97 | |         }
   | |_________^ help: replace with from: `usize::from(self.state.load(Ordering::SeqCst) & PUSHED != 0)`
   |
   = note: `(self.state.load(Ordering::SeqCst) & PUSHED != 0) as usize` or `(self.state.load(Ordering::SeqCst) & PUSHED != 0).into()` can also be valid options
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if
   = note: `#[warn(clippy::bool_to_int_with_if)]` on by default
```
2022-12-16 21:08:10 +09:00
Taiki Endo d14af85906 Remove msrv field from .clippy.toml
Since Rust 1.64, Clippy respects `rust-version` field in Cargo.toml.
rust-lang/rust@b776fb8
2022-11-27 15:59:17 +09:00
John Nunley 3d653aac40
Merge pull request #29 from smol-rs/2.0.0 2022-11-08 14:59:05 -08:00
jtnunley 34334a15dd v2.0.0 2022-11-08 09:57:13 -08:00
John Nunley 8c42b8dd9d
Add alternate implementations of synchronization primitives (#27) 2022-10-07 06:48:10 -07:00
John Nunley 06c99537c2
replace cache_padded with crossbeam-utils (#26) 2022-09-06 09:22:39 -07:00
John Nunley 9553e6fa92
Add benchmarks for bounded queues (#24) 2022-08-25 02:09:34 +09:00
John Nunley d3bf5a5424
Make it so this crate can be `no_std` (#22) 2022-08-25 02:09:13 +09:00
Taiki Endo 60354f9ea4 Format benches/bench.rs with rustfmt 2022-08-24 22:44:10 +09:00
Greg Morenz f8eca83b5f Add benchmarks for unbounded queues 2022-08-24 22:36:42 +09:00
Taiki Endo 812a733720 Release 1.2.4 2022-07-27 11:25:01 +09:00
Taiki Endo 434e8e9b2d Run more tests with Miri 2022-07-22 00:32:17 +09:00
Taiki Endo 9de877f9e0 Do not copy data before dropping 2022-07-22 00:03:27 +09:00
Taiki Endo d1218a02e0 Use get_mut instead of atomic load in Drop impls 2022-07-22 00:03:27 +09:00
Taiki Endo d61005fc79 Do not use x86 specific fence on Miri 2022-07-20 23:18:24 +09:00