AcctIdx: when stop_flush is disabled, prepare to age (#20113)

This commit is contained in:
Jeff Washington (jwash) 2021-09-23 11:42:32 -05:00 committed by GitHub
parent 038d77347a
commit fb55e9a9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -502,9 +502,10 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
fn start_stop_flush(&self, stop: bool) {
if stop {
self.stop_flush.fetch_add(1, Ordering::Acquire);
} else {
self.stop_flush.fetch_sub(1, Ordering::Release);
self.stop_flush.fetch_add(1, Ordering::Release);
} else if 1 == self.stop_flush.fetch_sub(1, Ordering::Release) {
// stop_flush went to 0, so this bucket could now be ready to be aged
self.storage.wait_dirty_or_aged.notify_one();
}
}