Skip to content

Commit

Permalink
Fix ordering for AccountEntry ref_count (solana-labs#26842)
Browse files Browse the repository at this point in the history
fix ordering for ref_count
  • Loading branch information
HaoranYi authored Jul 29, 2022
1 parent 422cff6 commit 38cd298
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtime/src/accounts_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ impl<T: IndexValue> AccountMapEntryInner<T> {
}
}
pub fn ref_count(&self) -> RefCount {
self.ref_count.load(Ordering::Relaxed)
self.ref_count.load(Ordering::Acquire)
}

pub fn add_un_ref(&self, add: bool) {
if add {
self.ref_count.fetch_add(1, Ordering::Relaxed);
self.ref_count.fetch_add(1, Ordering::Release);
} else {
self.ref_count.fetch_sub(1, Ordering::Relaxed);
self.ref_count.fetch_sub(1, Ordering::Release);
}
self.set_dirty(true);
}
Expand Down

0 comments on commit 38cd298

Please sign in to comment.