Grab read-lock instead of write-lock in From<PreAllocatedAccountMapEntry<T>> for (Slot, T) (#25770)

This commit is contained in:
Brooks Prumo 2022-06-03 15:48:32 -05:00 committed by GitHub
parent 0da0e0da63
commit edebd7e495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -369,7 +369,7 @@ impl<T: IndexValue> ZeroLamport for PreAllocatedAccountMapEntry<T> {
impl<T: IndexValue> From<PreAllocatedAccountMapEntry<T>> for (Slot, T) {
fn from(source: PreAllocatedAccountMapEntry<T>) -> (Slot, T) {
match source {
PreAllocatedAccountMapEntry::Entry(entry) => entry.slot_list.write().unwrap().remove(0),
PreAllocatedAccountMapEntry::Entry(entry) => entry.slot_list.read().unwrap()[0],
PreAllocatedAccountMapEntry::Raw(raw) => raw,
}
}