Skip to content
Draft
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
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
R-loom-sync:
- tokio/src/sync/*
- tokio/src/sync/**/*
- tokio-util/src/sync/*
- tokio-util/src/sync/**/*

R-loom-time-driver:
- tokio/src/runtime/time/*
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/loom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ jobs:
run: cargo test --lib --release --features full -- --nocapture sync::tests
working-directory: tokio

loom-util-sync:
name: loom tokio-util::sync
# base_ref is null when it's not a pull request
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-sync') || (github.base_ref == null))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2
- name: run tests
run: cargo test --lib --release --features default -- --nocapture sync::tests
working-directory: tokio-util

loom-time-driver:
name: loom time driver
# base_ref is null when it's not a pull request
Expand Down
3 changes: 3 additions & 0 deletions tokio-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ futures-test = "0.3.5"
parking_lot = "0.12.0"
tempfile = "3.1.0"

[target.'cfg(loom)'.dev-dependencies]
loom = { version = "0.7", features = ["futures", "checkpoint"] }

[package.metadata.docs.rs]
all-features = true
# enable unstable features in the documentation
Expand Down
6 changes: 6 additions & 0 deletions tokio-util/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ macro_rules! cfg_time {
)*
}
}

macro_rules! cfg_loom {
($($item:item)*) => {
$( #[cfg(loom)] $item )*
}
}
2 changes: 2 additions & 0 deletions tokio-util/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ pub use poll_semaphore::PollSemaphore;

mod reusable_box;
pub use reusable_box::ReusableBoxFuture;

mod tests;
4 changes: 3 additions & 1 deletion tokio-util/src/sync/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@

cfg_loom! {
mod loom_cancellation_token;
}
Loading