Skip to content

Commit e12c71b

Browse files
committed
Fixing Youngjae's comment
1 parent 909fc49 commit e12c71b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

rocksdb/rocksdb_db.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,16 @@ void RocksdbDB::Init() {
218218
}
219219

220220
void RocksdbDB::Cleanup() {
221+
const std::lock_guard<std::mutex> lock(mu_);
222+
if (--ref_cnt_) {
223+
return;
224+
}
221225
for (size_t i = 0; i < cf_handles_.size(); i++) {
222226
if (cf_handles_[i] != nullptr) {
223227
delete cf_handles_[i];
224228
cf_handles_[i] = nullptr;
225229
}
226230
}
227-
const std::lock_guard<std::mutex> lock(mu_);
228-
if (--ref_cnt_) {
229-
return;
230-
}
231231
delete db_;
232232
}
233233

rocksdb/rocksdb_db.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class RocksdbDB : public DB {
9292

9393
int fieldcount_;
9494

95-
std::vector<rocksdb::ColumnFamilyHandle *> cf_handles_;
95+
static std::vector<rocksdb::ColumnFamilyHandle *> cf_handles_;
9696
static rocksdb::DB *db_;
9797
static int ref_cnt_;
9898
static std::mutex mu_;

0 commit comments

Comments
 (0)