mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Stop using an upgradeable read lock in interning
Only one upgradeable read lock can be handed out at the same time, and we never acquire a non-upgradeable read lock, so this has no benefit over just using a write lock in the first place.
This commit is contained in:
parent
0129628a0f
commit
e73d26fa62
@ -25,7 +25,7 @@ impl<T: Internable> Interned<T> {
|
||||
let storage = T::storage().get();
|
||||
let shard_idx = storage.determine_map(&obj);
|
||||
let shard = &storage.shards()[shard_idx];
|
||||
let shard = shard.upgradeable_read();
|
||||
let mut shard = shard.write();
|
||||
|
||||
// Atomically,
|
||||
// - check if `obj` is already in the map
|
||||
@ -43,10 +43,7 @@ impl<T: Internable> Interned<T> {
|
||||
let arc = Arc::new(obj);
|
||||
let arc2 = arc.clone();
|
||||
|
||||
{
|
||||
let mut shard = shard.upgrade();
|
||||
shard.insert(arc2, SharedValue::new(()));
|
||||
}
|
||||
shard.insert(arc2, SharedValue::new(()));
|
||||
|
||||
Self { arc }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user