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

update dependencies and deprecated functions #99

Closed
wants to merge 8 commits into from
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
13 changes: 5 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ azure-devops = { project = "jonhoo/jonhoo", pipeline = "flurry", build = "15" }
codecov = { repository = "jonhoo/flurry", branch = "master", service = "github" }
maintenance = { status = "experimental" }

[features]
sanitize = ['crossbeam-epoch/sanitize']

[dependencies]
crossbeam-epoch = "0.8.2"
parking_lot = "0.10"
num_cpus = "1.12.0"
rayon = {version = "1.3", optional = true}
crossbeam-epoch = "0.9"
parking_lot = "0.11"
num_cpus = "1.13"
rayon = {version = "1.5", optional = true}
serde = {version = "1.0.105", optional = true}

[dependencies.ahash]
version = "0.3.2"
version = "0.7.6"
default-features = false

[dev-dependencies]
Expand Down
7 changes: 4 additions & 3 deletions src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ impl<K, V> Table<K, V> {
t if t.is_null() => {
// if a no next table is yet associated with this table,
// create one and store it in `self.next_table`
match self.next_table.compare_and_set(
match self.next_table.compare_exchange(
Shared::null(),
for_table,
Ordering::SeqCst,
Ordering::Relaxed,
guard,
) {
Ok(_) => {}
Expand Down Expand Up @@ -311,12 +312,12 @@ impl<K, V> Table<K, V> {
guard: &'g Guard,
) -> Result<
Shared<'g, BinEntry<K, V>>,
crossbeam_epoch::CompareAndSetError<'g, BinEntry<K, V>, P>,
crossbeam_epoch::CompareExchangeError<'g, BinEntry<K, V>, P>,
>
where
P: Pointer<BinEntry<K, V>>,
{
self.bins[i].compare_and_set(current, new, Ordering::AcqRel, guard)
self.bins[i].compare_exchange(current, new, Ordering::AcqRel, Ordering::Relaxed, guard)
}

#[inline]
Expand Down
19 changes: 14 additions & 5 deletions tests/cuckoo/stress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ impl Environment {
vals1: Mutex::new(vec![0usize; NUM_KEYS]),
vals2: Mutex::new(vec![0usize; NUM_KEYS]),
ind_dist: Uniform::from(0..NUM_KEYS - 1),
val_dist1: Uniform::from(Value::min_value()..Value::max_value()),
val_dist2: Uniform::from(Value::min_value()..Value::max_value()),
val_dist1: Uniform::from(Value::MIN..Value::MAX),
val_dist2: Uniform::from(Value::MIN..Value::MAX),
in_table: Mutex::new(vec![false; NUM_KEYS]),
in_use: Mutex::new(in_use),
finished: AtomicBool::new(false),
Expand All @@ -65,7 +65,10 @@ fn stress_insert_thread(env: Arc<Environment>) {
while !env.finished.load(Ordering::SeqCst) {
let idx = env.ind_dist.sample(&mut rng);
let in_use = env.in_use.lock();
if (*in_use)[idx].compare_and_swap(false, true, Ordering::SeqCst) {
if (*in_use)[idx]
.compare_exchange(false, true, Ordering::SeqCst, Ordering::Relaxed)
.is_ok()
{
let key = env.keys[idx];
let val1 = env.val_dist1.sample(&mut rng);
let val2 = env.val_dist2.sample(&mut rng);
Expand Down Expand Up @@ -102,7 +105,10 @@ fn stress_delete_thread(env: Arc<Environment>) {
while !env.finished.load(Ordering::SeqCst) {
let idx = env.ind_dist.sample(&mut rng);
let in_use = env.in_use.lock();
if (*in_use)[idx].compare_and_swap(false, true, Ordering::SeqCst) {
if (*in_use)[idx]
.compare_exchange(false, true, Ordering::SeqCst, Ordering::Relaxed)
.is_ok()
{
let key = env.keys[idx];
let res1 = env.table1.remove(&key, &guard).map_or(false, |_| true);
let res2 = env.table2.remove(&key, &guard).map_or(false, |_| true);
Expand All @@ -125,7 +131,10 @@ fn stress_find_thread(env: Arc<Environment>) {
while !env.finished.load(Ordering::SeqCst) {
let idx = env.ind_dist.sample(&mut rng);
let in_use = env.in_use.lock();
if (*in_use)[idx].compare_and_swap(false, true, Ordering::SeqCst) {
if (*in_use)[idx]
.compare_exchange(false, true, Ordering::SeqCst, Ordering::Relaxed)
.is_ok()
{
let key = env.keys[idx];
let in_table = env.in_table.lock();
let val1 = (*env.vals1.lock())[idx];
Expand Down