SuperVersion::Unref() to use sequential consistency to decrease ref counting

Summary: I'm not sure the expected results of std::atomic::fetch_sub() when using memory_order_relaxed, and I suspect TSAN complains.

Test Plan: make all check

Reviewers: rven, yhchiang, igor

Reviewed By: igor

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D32259
main
sdong 10 years ago
parent 4c49fedaf1
commit e919ecedfc
  1. 2
      db/column_family.cc

@ -181,7 +181,7 @@ SuperVersion* SuperVersion::Ref() {
bool SuperVersion::Unref() { bool SuperVersion::Unref() {
// fetch_sub returns the previous value of ref // fetch_sub returns the previous value of ref
uint32_t previous_refs = refs.fetch_sub(1, std::memory_order_relaxed); uint32_t previous_refs = refs.fetch_sub(1);
assert(previous_refs > 0); assert(previous_refs > 0);
return previous_refs == 1; return previous_refs == 1;
} }

Loading…
Cancel
Save