Skip to content
Closed
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: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
MSRV: 1.42.0
MSRV: 1.68.0

jobs:
build:
Expand Down
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ documentation = "https://docs.rs/sharded-slab/"
homepage = "https://github.com/hawkw/sharded-slab"
repository = "https://github.com/hawkw/sharded-slab"
readme = "README.md"
rust-version = "1.42.0"
rust-version = "1.68.0"
license = "MIT"
keywords = ["slab", "allocator", "lock-free", "atomic"]
categories = ["memory-management", "data-structures", "concurrency"]
Expand All @@ -32,9 +32,6 @@ maintenance = { status = "experimental" }
name = "bench"
harness = false

[dependencies]
lazy_static = "1"

[dev-dependencies]
proptest = "1"
criterion = "0.3"
Expand Down
8 changes: 1 addition & 7 deletions src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
macro_rules! test_println {
($($arg:tt)*) => {
if cfg!(test) && cfg!(slab_print) {
if std::thread::panicking() {
// getting the thread ID while panicking doesn't seem to play super nicely with loom's
// mock lazy_static...
println!("[PANIC {:>17}:{:<3}] {}", file!(), line!(), format_args!($($arg)*))
} else {
println!("[{:?} {:>17}:{:<3}] {}", crate::Tid::<crate::DefaultConfig>::current(), file!(), line!(), format_args!($($arg)*))
}
println!("[{:?} {:>17}:{:<3}] {}", crate::Tid::<crate::DefaultConfig>::current(), file!(), line!(), format_args!($($arg)*))
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ mod inner {
pub use loom::sync::atomic::*;
pub use std::sync::atomic::Ordering;
}
pub(crate) use loom::{
cell::UnsafeCell, hint, lazy_static, sync::Mutex, thread::yield_now, thread_local,
};
pub(crate) use loom::{cell::UnsafeCell, hint, sync::Mutex, thread::yield_now, thread_local};

pub(crate) mod alloc {
#![allow(dead_code)]
Expand Down Expand Up @@ -63,7 +61,6 @@ mod inner {
#[cfg(not(all(loom, any(feature = "loom", test))))]
mod inner {
#![allow(dead_code)]
pub(crate) use lazy_static::lazy_static;
pub(crate) use std::{
sync::{atomic, Mutex},
thread::yield_now,
Expand Down
18 changes: 5 additions & 13 deletions src/tid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
page,
sync::{
atomic::{AtomicUsize, Ordering},
lazy_static, thread_local, Mutex,
thread_local, Mutex,
},
Pack,
};
Expand All @@ -29,12 +29,10 @@ struct Registry {
free: Mutex<VecDeque<usize>>,
}

lazy_static! {
static ref REGISTRY: Registry = Registry {
next: AtomicUsize::new(0),
free: Mutex::new(VecDeque::new()),
};
}
static REGISTRY: Registry = Registry {
next: AtomicUsize::new(0),
free: Mutex::new(VecDeque::new()),
};

thread_local! {
static REGISTRATION: Registration = Registration::new();
Expand Down Expand Up @@ -177,12 +175,6 @@ impl Registration {
}
}

// Reusing thread IDs doesn't work under loom, since this `Drop` impl results in
// an access to a `loom` lazy_static while the test is shutting down, which
// panics. T_T
// Just skip TID reuse and use loom's lazy_static macro to ensure we have a
// clean initial TID on every iteration, instead.
#[cfg(not(all(loom, any(feature = "loom", test))))]
impl Drop for Registration {
fn drop(&mut self) {
use std::sync::PoisonError;
Expand Down