Skip to content

Commit

Permalink
Use Mutex only on targets with target_has_atomic less than 64
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Sep 8, 2019
1 parent 5e8b798 commit 3e86b76
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
14 changes: 7 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ jobs:
- tokio-no-features
- tokio-with-net

# # Try cross compiling
# - template: ci/azure-cross-compile.yml
# parameters:
# name: cross_32bit_linux
# target: i686-unknown-linux-gnu
#
# Try cross compiling
- template: ci/azure-cross-compile.yml
parameters:
name: cross
rust: $(nightly)

# # This represents the minimum Rust version supported by
# # Tokio. Updating this should be done in a dedicated PR and
# # cannot be greater than two 0.x releases prior to the
Expand Down Expand Up @@ -127,6 +127,6 @@ jobs:
- test_linux
- test_features
# - test_nightly
# - cross_32bit_linux
- cross
# - minrust
# - tsan
32 changes: 23 additions & 9 deletions ci/azure-cross-compile.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
jobs:
- job: ${{ parameters.name }}
displayName: ${{ parameters.displayName }}
strategy:
matrix:
i686:
vmImage: ubuntu-16.04
target: i686-unknown-linux-gnu
powerpc:
vmImage: ubuntu-16.04
target: powerpc-unknown-linux-gnu
powerpc64:
vmImage: ubuntu-16.04
target: powerpc64-unknown-linux-gnu
mips:
vmImage: ubuntu-16.04
target: mips-unknown-linux-gnu
pool:
vmImage: ubuntu-16.04
vmImage: $(vmImage)
steps:
- template: azure-install-rust.yml
parameters:
rust_version: stable
rust_version: ${{ parameters.rust }}

- script: sudo apt-get update
displayName: "apt-get update"
displayName: apt-get update

- script: sudo apt-get install gcc-multilib
displayName: "Install gcc-multilib"
displayName: Install gcc-multilib

- script: rustup target add ${{ parameters.target }}
displayName: "Add target"
- script: cargo install cross
displayName: Install cross

# Always patch
- template: azure-patch-crates.yml

- script: cargo check --all --exclude tokio-tls --target ${{ parameters.target }}
- script: cross check --all --exclude tokio-tls --target $(target)
displayName: Check source

- script: cargo check --tests --all --exclude tokio-tls --target ${{ parameters.target }}
displayName: Check tests
# - script: cross check --tests --all --exclude tokio-tls --target $(target)
# displayName: Check tests
7 changes: 5 additions & 2 deletions tokio-timer/src/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

pub(crate) use self::imp::AtomicU64;

#[cfg(target_pointer_width = "64")]
// `AtomicU64` can only be used on targets with `target_has_atomic` is 64 or greater.
// Once `cfg_target_has_atomic` feature is stable, we can replace it with
// `#[cfg(target_has_atomic = "64")]`.
#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))]
mod imp {
pub(crate) use std::sync::atomic::AtomicU64;
}

#[cfg(not(target_pointer_width = "64"))]
#[cfg(any(target_arch = "mips", target_arch = "powerpc"))]
mod imp {
use std::sync::atomic::Ordering;
use std::sync::Mutex;
Expand Down

0 comments on commit 3e86b76

Please sign in to comment.