Merge pull request #19770 from shinobu-x/mempool_lock

common: s/unique_lock/lock_guard/, if manual lock/unlock are not necessary

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Kefu Chai 2018-01-30 10:08:48 +08:00 committed by GitHub
commit 8d5da83ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,7 @@ void mempool::pool_t::get_stats(
total->bytes += shard[i].bytes;
}
if (debug_mode) {
std::unique_lock<std::mutex> shard_lock(lock);
std::lock_guard<std::mutex> shard_lock(lock);
for (auto &p : type_map) {
std::string n = ceph_demangle(p.second.type_name);
stats_t &s = (*by_type)[n];