mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-31 01:20:40 +08:00
Remove the Upgrade lock stuff. (#221)
* Remove the `Upgrade` lock stuff. * Need to repeat the `find()` if we released the mutex to get a write lock. * Add a couple `assert`s.
This commit is contained in:
committed by
GitHub
parent
7556c955d4
commit
4c93cf00f2
Vendored
+5
-3
@@ -3465,12 +3465,14 @@ public:
|
||||
auto hashval = this->hash(key);
|
||||
Inner& inner = sets_[subidx(hashval)];
|
||||
auto& set = inner.set_;
|
||||
typename Lockable::UpgradeLock m(inner);
|
||||
typename Lockable::ReadWriteLock m(inner);
|
||||
auto it = set.find(key, hashval);
|
||||
if (it == set.end())
|
||||
return 0;
|
||||
|
||||
typename Lockable::UpgradeToUnique unique(m);
|
||||
|
||||
if (m.switch_to_unique()) {
|
||||
it = set.find(key, hashval);
|
||||
}
|
||||
set._erase(it);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user