Skip to content

Commit f95e39b

Browse files
committed
Use parking_lot
1 parent 0cf93bb commit f95e39b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ lazy_static = "1"
2727
serde = { version = "1", optional = true }
2828
phf_shared = "0.8"
2929
new_debug_unreachable = "1.0"
30+
parking_lot = "0.11"
3031

3132
[[test]]
3233
name = "small-stack"

src/atom.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl<'a, Static: StaticAtomSet> From<Cow<'a, str>> for Atom<Static> {
201201
}
202202
} else {
203203
let ptr: std::ptr::NonNull<Entry> =
204-
DYNAMIC_SET.lock().unwrap().insert(string_to_add, hash.g);
204+
DYNAMIC_SET.lock().insert(string_to_add, hash.g);
205205
let data = ptr.as_ptr() as u64;
206206
debug_assert!(0 == data & TAG_MASK);
207207
Atom {
@@ -239,7 +239,6 @@ impl<Static> Drop for Atom<Static> {
239239
fn drop_slow<Static>(this: &mut Atom<Static>) {
240240
DYNAMIC_SET
241241
.lock()
242-
.unwrap()
243242
.remove(this.unsafe_data.get() as *mut Entry);
244243
}
245244
}

src/dynamic_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
// except according to those terms.
99

1010
use lazy_static::lazy_static;
11+
use parking_lot::Mutex;
1112
use std::borrow::Cow;
1213
use std::mem;
1314
use std::ptr::NonNull;
1415
use std::sync::atomic::AtomicIsize;
1516
use std::sync::atomic::Ordering::SeqCst;
16-
use std::sync::Mutex;
1717

1818
const NB_BUCKETS: usize = 1 << 12; // 4096
1919
const BUCKET_MASK: u32 = (1 << 12) - 1;

0 commit comments

Comments
 (0)