Skip to content

Commit cb98021

Browse files
committed
Add a comment after SignalAll()
Summary: Having code after SignalAll has already caused 2 bugs. Let's make sure this doesn't happen again. Test Plan: no test Reviewers: sdong, dhruba, haobo Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D16785
1 parent 01dcef1 commit cb98021

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

db/db_impl.cc

+8
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,10 @@ void DBImpl::BackgroundCallFlush() {
19241924
MaybeScheduleFlushOrCompaction();
19251925
}
19261926
bg_cv_.SignalAll();
1927+
// IMPORTANT: there should be no code after calling SignalAll. This call may
1928+
// signal the DB destructor that it's OK to proceed with destruction. In
1929+
// that case, all DB variables will be dealloacated and referencing them
1930+
// will cause trouble.
19271931
}
19281932
log_buffer.FlushBufferToLog();
19291933
}
@@ -1993,6 +1997,10 @@ void DBImpl::BackgroundCallCompaction() {
19931997
MaybeScheduleFlushOrCompaction();
19941998
}
19951999
bg_cv_.SignalAll();
2000+
// IMPORTANT: there should be no code after calling SignalAll. This call may
2001+
// signal the DB destructor that it's OK to proceed with destruction. In
2002+
// that case, all DB variables will be dealloacated and referencing them
2003+
// will cause trouble.
19962004
}
19972005
log_buffer.FlushBufferToLog();
19982006
}

0 commit comments

Comments
 (0)