Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
John Nunley | 2071dc75fd | |
Taiki Endo | 4e12f87041 | |
Taiki Endo | cddad24dc8 | |
Taiki Endo | 6d14c5c0a5 | |
Taiki Endo | 8b45665e19 | |
Taiki Endo | 0c1166ed10 | |
Taiki Endo | d11a485852 | |
Taiki Endo | 5bc031be33 | |
Taiki Endo | 2d7017155f | |
Taiki Endo | c892839b10 | |
Taiki Endo | 1bce44b030 |
|
@ -0,0 +1,9 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: cargo
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
commit-message:
|
||||
prefix: ''
|
||||
labels: []
|
|
@ -1,43 +0,0 @@
|
|||
name: Build and test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
rust: [nightly, beta, stable]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install latest ${{ matrix.rust }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Run cargo check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --all --bins --examples --tests --all-features
|
||||
|
||||
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
|
||||
if: startsWith(matrix.rust, 'nightly')
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: -Z features=dev_dep
|
||||
|
||||
- name: Run cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
|
@ -0,0 +1,78 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
- cron: '0 2 * * 0'
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_NET_RETRY: 10
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: 1
|
||||
RUSTFLAGS: -D warnings -A deprecated
|
||||
RUSTDOCFLAGS: -D warnings
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
rust: [nightly, beta, stable]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
|
||||
- run: cargo build --all --all-features --all-targets
|
||||
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
|
||||
if: startsWith(matrix.rust, 'nightly')
|
||||
run: cargo check -Z features=dev_dep
|
||||
- run: cargo test
|
||||
|
||||
msrv:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# When updating this, the reminder to update the minimum supported
|
||||
# Rust version in Cargo.toml.
|
||||
rust: ['1.31']
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
|
||||
- run: cargo build
|
||||
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
- run: cargo clippy --all-features --all-targets
|
||||
|
||||
fmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
- run: cargo fmt --all --check
|
||||
|
||||
security_audit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# https://github.com/rustsec/audit-check/issues/2
|
||||
- uses: rustsec/audit-check@master
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -1,23 +0,0 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
components: clippy
|
||||
- uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --all-features -- -W clippy::all
|
|
@ -5,19 +5,12 @@ on:
|
|||
tags:
|
||||
- v[0-9]+.*
|
||||
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
if: github.repository_owner == 'smol-rs'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
- run: cargo package
|
||||
- uses: actions/checkout@v3
|
||||
- uses: taiki-e/create-gh-release-action@v1
|
||||
with:
|
||||
changelog: CHANGELOG.md
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
name: Security audit
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
security_audit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/audit-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -1,6 +1,10 @@
|
|||
# Version 1.3.0
|
||||
|
||||
- This crate is now deprecated in favor of [crossbeam-utils::CachePadded](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html).
|
||||
|
||||
# Version 1.2.0
|
||||
|
||||
- Improve implementation of `CachePadded`.
|
||||
- Improve implementation of `CachePadded`. (#8)
|
||||
|
||||
# Version 1.1.1
|
||||
|
||||
|
|
|
@ -3,12 +3,14 @@ name = "cache-padded"
|
|||
# When publishing a new version:
|
||||
# - Update CHANGELOG.md
|
||||
# - Create "v1.x.y" git tag
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
authors = ["Stjepan Glavina <stjepang@gmail.com>"]
|
||||
edition = "2018"
|
||||
rust-version = "1.31"
|
||||
description = "Prevent false sharing by padding and aligning to the length of a cache line"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
repository = "https://github.com/smol-rs/cache-padded"
|
||||
homepage = "https://github.com/smol-rs/cache-padded"
|
||||
keywords = ["cache", "padding", "lock-free", "atomic"]
|
||||
categories = ["concurrency", "no-std"]
|
||||
exclude = ["/.*"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# cache-padded
|
||||
# cache-padded (deprecated)
|
||||
|
||||
[![Build](https://github.com/smol-rs/cache-padded/workflows/Build%20and%20test/badge.svg)](
|
||||
https://github.com/smol-rs/cache-padded/actions)
|
||||
|
@ -9,6 +9,8 @@ https://crates.io/crates/cache-padded)
|
|||
[![Documentation](https://docs.rs/cache-padded/badge.svg)](
|
||||
https://docs.rs/cache-padded)
|
||||
|
||||
**This crate is now deprecated in favor of [crossbeam-utils::CachePadded](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html).**
|
||||
|
||||
Prevent false sharing by padding and aligning to the length of a cache line.
|
||||
|
||||
In concurrent programming, sometimes it is desirable to make sure commonly accessed shared data
|
||||
|
@ -21,7 +23,9 @@ data.
|
|||
|
||||
Cache lines are assumed to be N bytes long, depending on the architecture:
|
||||
|
||||
* On x86-64 and aarch64, N = 128.
|
||||
* On x86-64, aarch64, and powerpc64, N = 128.
|
||||
* On arm, mips, mips64, and riscv64, N = 32.
|
||||
* On s390x, N = 256.
|
||||
* On all others, N = 64.
|
||||
|
||||
Note that N is just a reasonable guess and is not guaranteed to match the actual cache line
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
//! * On x86-64, aarch64, and powerpc64, N = 128.
|
||||
//! * On arm, mips, mips64, and riscv64, N = 32.
|
||||
//! * On s390x, N = 256.
|
||||
//! * On all others, N = 64.
|
||||
//!
|
||||
//! Note that N is just a reasonable guess and is not guaranteed to match the actual cache line
|
||||
//! length of the machine the program is running on.
|
||||
|
@ -56,6 +57,10 @@
|
|||
#![no_std]
|
||||
#![forbid(unsafe_code)]
|
||||
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)]
|
||||
#![deprecated(
|
||||
since = "1.3.0",
|
||||
note = "This crate is now deprecated in favor of [crossbeam-utils::CachePadded](https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html)."
|
||||
)]
|
||||
|
||||
use core::fmt;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
|
|
|
@ -80,6 +80,7 @@ fn drops() {
|
|||
assert_eq!(count.get(), 2);
|
||||
}
|
||||
|
||||
#[allow(clippy::clone_on_copy)] // This is intentional
|
||||
#[test]
|
||||
fn clone() {
|
||||
let a = CachePadded::new(17);
|
||||
|
|
Loading…
Reference in New Issue