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.
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
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 }
}