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

Roll algorithm back to v2.5.3, then add back features to avoid a breaking change #130

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
61 changes: 0 additions & 61 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,6 @@ jobs:
- run: rustup target add thumbv7m-none-eabi
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
run: cargo hack build --all --no-dev-deps
- run: cargo hack build --all --target thumbv7m-none-eabi --no-default-features --no-dev-deps
- run: cargo hack build --target thumbv7m-none-eabi --no-default-features --no-dev-deps --features portable-atomic
- name: Install wasm-pack
uses: taiki-e/install-action@wasm-pack
- run: wasm-pack test --node
- run: wasm-pack test --node --no-default-features
- run: wasm-pack test --node --no-default-features --features portable-atomic
- name: Clone some dependent crates
run: |
git clone https://github.com/smol-rs/event-listener-strategy.git
git clone https://github.com/smol-rs/async-channel.git
git clone https://github.com/smol-rs/async-lock.git
- name: Patch dependent crates
run: |
echo '[patch.crates-io]' >> event-listener-strategy/Cargo.toml
echo 'event-listener = { path = ".." }' >> event-listener-strategy/Cargo.toml
echo '[patch.crates-io]' >> async-channel/Cargo.toml
echo 'event-listener = { path = ".." }' >> async-channel/Cargo.toml
echo 'event-listener-strategy = { path = "../event-listener-strategy" }' >> async-channel/Cargo.toml
echo '[patch.crates-io]' >> async-lock/Cargo.toml
echo 'event-listener = { path = ".." }' >> async-lock/Cargo.toml
echo 'event-listener-strategy = { path = "../event-listener-strategy" }' >> async-lock/Cargo.toml
echo 'async-channel = { path = "../async-channel" }' >> async-lock/Cargo.toml
- name: Test dependent crates
run: |
cargo test --manifest-path=event-listener-strategy/Cargo.toml
cargo test --manifest-path=async-channel/Cargo.toml
cargo test --manifest-path=async-lock/Cargo.toml

msrv:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -122,28 +94,6 @@ jobs:
- run: cargo miri test --all
- run: cargo miri test --no-default-features --tests
- run: cargo miri test --no-default-features --features portable-atomic --tests
- name: Clone some dependent crates
run: |
git clone https://github.com/smol-rs/event-listener-strategy.git
git clone https://github.com/smol-rs/async-channel.git
git clone https://github.com/smol-rs/async-lock.git
- name: Patch dependent crates
run: |
echo '[patch.crates-io]' >> event-listener-strategy/Cargo.toml
echo 'event-listener = { path = ".." }' >> event-listener-strategy/Cargo.toml
echo '[patch.crates-io]' >> async-channel/Cargo.toml
echo 'event-listener = { path = ".." }' >> async-channel/Cargo.toml
echo 'event-listener-strategy = { path = "../event-listener-strategy" }' >> async-channel/Cargo.toml
echo '[patch.crates-io]' >> async-lock/Cargo.toml
echo 'event-listener = { path = ".." }' >> async-lock/Cargo.toml
echo 'event-listener-strategy = { path = "../event-listener-strategy" }' >> async-lock/Cargo.toml
echo 'async-channel = { path = "../async-channel" }' >> async-lock/Cargo.toml
- name: Test dependent crates
# async-channel isn't included here as it appears to be broken on MIRI.
# See https://github.com/smol-rs/async-channel/issues/85
run: |
cargo miri test --manifest-path=event-listener-strategy/Cargo.toml
cargo miri test --manifest-path=async-lock/Cargo.toml

security_audit:
permissions:
Expand All @@ -157,14 +107,3 @@ jobs:
- uses: rustsec/audit-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}

loom:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- name: Loom tests
run: RUSTFLAGS="--cfg=loom" cargo test --release --test loom --features loom


42 changes: 11 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name = "event-listener"
# - Update CHANGELOG.md
# - Create "v5.x.y" git tag
version = "5.3.0"
authors = ["Stjepan Glavina <stjepang@gmail.com>"]
authors = ["Stjepan Glavina <stjepang@gmail.com>", "John Nunley <dev@notgull.net>"]
edition = "2021"
rust-version = "1.60"
rust-version = "1.63"
description = "Notify async tasks or threads"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/smol-rs/event-listener"
Expand All @@ -16,43 +16,23 @@ exclude = ["/.*"]

[features]
default = ["std"]
std = ["concurrent-queue/std", "parking"]
portable-atomic = ["portable-atomic-util", "portable_atomic_crate"]
loom = ["concurrent-queue/loom", "parking?/loom", "dep:loom"]
std = []
portable-atomic = ["portable-atomic-crate", "portable-atomic-util"]

[dependencies]
concurrent-queue = { version = "2.4.0", default-features = false }
pin-project-lite = "0.2.12"
portable-atomic-util = { version = "0.1.4", default-features = false, optional = true, features = ["alloc"] }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
parking = { version = "2.0.0", optional = true }

[target.'cfg(loom)'.dependencies]
loom = { version = "0.7", optional = true }

[dependencies.portable_atomic_crate]
package = "portable-atomic"
version = "1.2.0"
default-features = false
optional = true
portable-atomic-crate = { version = "1.6.0", package = "portable-atomic", optional = true }
portable-atomic-util = { version = "0.1.5", optional = true, features = ["alloc"] }

[dev-dependencies]
futures-lite = "2.0.0"
try-lock = "0.2.5"
futures = { version = "0.3", default-features = false, features = ["std"] }
futures-lite = "2.3.0"
criterion = { version = "0.3.4", default-features = false, features = ["cargo_bench_support"] }
waker-fn = "1"

[dev-dependencies.criterion]
version = "0.5"
default-features = false
features = ["cargo_bench_support"]

[target.'cfg(target_family = "wasm")'.dev-dependencies]
wasm-bindgen-test = "0.3"

[[bench]]
name = "bench"
harness = false
required-features = ["std"]

[lib]
bench = false
bench = false
5 changes: 1 addition & 4 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use std::iter;

use criterion::{criterion_group, criterion_main, Criterion};
use event_listener::{Event, Listener};
use std::iter;

const COUNT: usize = 8000;

fn bench_events(c: &mut Criterion) {
c.bench_function("notify_and_wait", |b| {
let ev = Event::new();
let mut handles = Vec::with_capacity(COUNT);

b.iter(|| {
handles.extend(iter::repeat_with(|| ev.listen()).take(COUNT));

ev.notify(COUNT);

for handle in handles.drain(..) {
Expand Down
Loading
Loading