working-directory: tokio
env:
SCOPE: ${{ matrix.scope }}
-
- loom-multi-thread-alt:
- name: loom ALT multi-thread scheduler
- # 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-multi-thread-alt') || (github.base_ref == null))
- runs-on: ubuntu-latest
- strategy:
- matrix:
- include:
- - scope: loom_multi_thread_alt::group_a
- - scope: loom_multi_thread_alt::group_b
- - scope: loom_multi_thread_alt::group_c
- - scope: loom_multi_thread_alt::group_d
- 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: loom ${{ matrix.scope }}
- run: cargo test --lib --release --features full -- --nocapture $SCOPE
- working-directory: tokio
- env:
- SCOPE: ${{ matrix.scope }}
.into()
}
}
-
- #[cfg(not(target_os = "wasi"))] // Wasi doesn't support threads
- #[cfg(tokio_unstable)]
- mod alt_threaded_scheduler_4_threads {
- $($t)*
-
- const NUM_WORKERS: usize = 4;
-
- fn rt() -> Arc<Runtime> {
- tokio::runtime::Builder::new_multi_thread()
- .worker_threads(4)
- .enable_all()
- .build()
- .unwrap()
- .into()
- }
- }
-
- #[cfg(not(target_os = "wasi"))] // Wasi doesn't support threads
- #[cfg(tokio_unstable)]
- mod alt_threaded_scheduler_1_thread {
- $($t)*
-
- const NUM_WORKERS: usize = 1;
-
- fn rt() -> Arc<Runtime> {
- tokio::runtime::Builder::new_multi_thread()
- .worker_threads(1)
- .enable_all()
- .build()
- .unwrap()
- .into()
- }
- }
}
}