Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/memstore: Fix wrong use of lock_guard #20914

Merged
merged 1 commit into from
Mar 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/os/memstore/MemStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -566,35 +566,35 @@ class MemStore::OmapIteratorImpl : public ObjectMap::ObjectMapIteratorImpl {
: c(c), o(o), it(o->omap.begin()) {}

int seek_to_first() override {
std::lock_guard<std::mutex>(o->omap_mutex);
std::lock_guard<std::mutex> lock(o->omap_mutex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, no need to specify the std::mutex template argument anymore, as we've switched to C++17.

it = o->omap.begin();
return 0;
}
int upper_bound(const string &after) override {
std::lock_guard<std::mutex>(o->omap_mutex);
std::lock_guard<std::mutex> lock(o->omap_mutex);
it = o->omap.upper_bound(after);
return 0;
}
int lower_bound(const string &to) override {
std::lock_guard<std::mutex>(o->omap_mutex);
std::lock_guard<std::mutex> lock(o->omap_mutex);
it = o->omap.lower_bound(to);
return 0;
}
bool valid() override {
std::lock_guard<std::mutex>(o->omap_mutex);
std::lock_guard<std::mutex> lock(o->omap_mutex);
return it != o->omap.end();
}
int next(bool validate=true) override {
std::lock_guard<std::mutex>(o->omap_mutex);
std::lock_guard<std::mutex> lock(o->omap_mutex);
++it;
return 0;
}
string key() override {
std::lock_guard<std::mutex>(o->omap_mutex);
std::lock_guard<std::mutex> lock(o->omap_mutex);
return it->first;
}
bufferlist value() override {
std::lock_guard<std::mutex>(o->omap_mutex);
std::lock_guard<std::mutex> lock(o->omap_mutex);
return it->second;
}
int status() override {
Expand Down