Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/bdb.cpp
Show First 20 Lines • Show All 693 Lines • ▼ Show 20 Lines | bool BerkeleyDatabase::PeriodicFlush() { | ||||
// Don't flush if we can't acquire the lock. | // Don't flush if we can't acquire the lock. | ||||
TRY_LOCK(cs_db, lockDb); | TRY_LOCK(cs_db, lockDb); | ||||
if (!lockDb) { | if (!lockDb) { | ||||
return false; | return false; | ||||
} | } | ||||
// Don't flush if any databases are in use | // Don't flush if any databases are in use | ||||
for (auto it = env->mapFileUseCount.begin(); | for (const auto &use_count : env->mapFileUseCount) { | ||||
it != env->mapFileUseCount.end(); it++) { | if (use_count.second > 0) { | ||||
if ((*it).second > 0) { | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
// Don't flush if there haven't been any batch writes for this database. | // Don't flush if there haven't been any batch writes for this database. | ||||
auto it = env->mapFileUseCount.find(strFile); | auto it = env->mapFileUseCount.find(strFile); | ||||
if (it == env->mapFileUseCount.end()) { | if (it == env->mapFileUseCount.end()) { | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |