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

Use mocked AtomicU64 in IO metrics driver #4649

Merged
merged 8 commits into from May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -228,6 +228,7 @@ jobs:
- powerpc64-unknown-linux-gnu
- mips-unknown-linux-gnu
- arm-linux-androideabi
- mipsel-unknown-linux-musl
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ env.rust_stable }}
Expand All @@ -241,7 +242,14 @@ jobs:
with:
use-cross: true
command: check
args: --workspace --target ${{ matrix.target }}
args: --workspace --all-features --target ${{ matrix.target }}
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: check
args: --workspace --all-features --target ${{ matrix.target }}
env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings

features:
name: features
Expand Down
4 changes: 4 additions & 0 deletions Cross.toml
@@ -0,0 +1,4 @@
[build.env]
passthrough = [
"RUSTFLAGS",
]
8 changes: 8 additions & 0 deletions tokio/src/loom/std/atomic_u64.rs
Expand Up @@ -75,4 +75,12 @@ cfg_not_has_atomic_u64! {
self.compare_exchange(current, new, success, failure)
}
}

impl Default for AtomicU64 {
fn default() -> AtomicU64 {
Self {
inner: Mutex::new(0),
}
}
}
}
2 changes: 1 addition & 1 deletion tokio/src/runtime/metrics/io.rs
@@ -1,6 +1,6 @@
#![cfg_attr(not(feature = "net"), allow(dead_code))]

use std::sync::atomic::{AtomicU64, Ordering::Relaxed};
use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};

#[derive(Default)]
pub(crate) struct IoDriverMetrics {
Expand Down