Skip to content

Commit

Permalink
Add a comment after SignalAll()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
igorcanadi committed Mar 11, 2014
1 parent 01dcef1 commit cb98021
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,10 @@ void DBImpl::BackgroundCallFlush() {
MaybeScheduleFlushOrCompaction();
}
bg_cv_.SignalAll();
// IMPORTANT: there should be no code after calling SignalAll. This call may
// signal the DB destructor that it's OK to proceed with destruction. In
// that case, all DB variables will be dealloacated and referencing them
// will cause trouble.
}
log_buffer.FlushBufferToLog();
}
Expand Down Expand Up @@ -1993,6 +1997,10 @@ void DBImpl::BackgroundCallCompaction() {
MaybeScheduleFlushOrCompaction();
}
bg_cv_.SignalAll();
// IMPORTANT: there should be no code after calling SignalAll. This call may
// signal the DB destructor that it's OK to proceed with destruction. In
// that case, all DB variables will be dealloacated and referencing them
// will cause trouble.
}
log_buffer.FlushBufferToLog();
}
Expand Down

0 comments on commit cb98021

Please sign in to comment.