summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2018-10-16 16:32:22 +0200
committerKefu Chai <kchai@redhat.com>2018-11-21 04:56:32 +0100
commiteff769117e9210a4f1d8787587d3e83afe1e572c (patch)
treeb52167d440b3c045da1cdb98a19fb348efa094d7 /src
parentcommon/perf_counters: Mutex -> ceph::mutex (diff)
downloadceph-eff769117e9210a4f1d8787587d3e83afe1e572c.tar.xz
ceph-eff769117e9210a4f1d8787587d3e83afe1e572c.zip
common/PluginRegistry: Mutex -> ceph::mutex
Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/common/PluginRegistry.cc13
-rw-r--r--src/common/PluginRegistry.h4
-rw-r--r--src/test/compressor/test_compression.cc2
3 files changed, 9 insertions, 10 deletions
diff --git a/src/common/PluginRegistry.cc b/src/common/PluginRegistry.cc
index fd937df0a6e..2cb7fcee8db 100644
--- a/src/common/PluginRegistry.cc
+++ b/src/common/PluginRegistry.cc
@@ -36,7 +36,6 @@
PluginRegistry::PluginRegistry(CephContext *cct) :
cct(cct),
- lock("PluginRegistry::lock"),
loading(false),
disable_dlclose(false)
{
@@ -62,7 +61,7 @@ PluginRegistry::~PluginRegistry()
int PluginRegistry::remove(const std::string& type, const std::string& name)
{
- ceph_assert(lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(lock));
std::map<std::string,std::map<std::string,Plugin*> >::iterator i =
plugins.find(type);
@@ -87,7 +86,7 @@ int PluginRegistry::add(const std::string& type,
const std::string& name,
Plugin* plugin)
{
- ceph_assert(lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(lock));
if (plugins.count(type) &&
plugins[type].count(name)) {
return -EEXIST;
@@ -101,7 +100,7 @@ int PluginRegistry::add(const std::string& type,
Plugin *PluginRegistry::get_with_load(const std::string& type,
const std::string& name)
{
- std::lock_guard<Mutex> l(lock);
+ std::lock_guard l(lock);
Plugin* ret = get(type, name);
if (!ret) {
int err = load(type, name);
@@ -114,7 +113,7 @@ Plugin *PluginRegistry::get_with_load(const std::string& type,
Plugin *PluginRegistry::get(const std::string& type,
const std::string& name)
{
- ceph_assert(lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(lock));
Plugin *ret = 0;
std::map<std::string,Plugin*>::iterator j;
@@ -136,7 +135,7 @@ Plugin *PluginRegistry::get(const std::string& type,
int PluginRegistry::load(const std::string &type,
const std::string &name)
{
- ceph_assert(lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(lock));
ldout(cct, 1) << __func__ << " " << type << " " << name << dendl;
// std::string fname = cct->_conf->plugin_dir + "/" + type + "/" PLUGIN_PREFIX
@@ -218,7 +217,7 @@ int ErasureCodePluginRegistry::preload(const std::string &plugins,
const std::string &directory,
ostream &ss)
{
- std::lock_guard<Mutex> l(lock);
+ std::lock_guard l(lock);
list<string> plugins_list;
get_str_list(plugins, plugins_list);
for (list<string>::iterator i = plugins_list.begin();
diff --git a/src/common/PluginRegistry.h b/src/common/PluginRegistry.h
index 4faa2455500..5a092def7c5 100644
--- a/src/common/PluginRegistry.h
+++ b/src/common/PluginRegistry.h
@@ -19,7 +19,7 @@
#define CEPH_COMMON_PLUGINREGISTRY_H
#include <map>
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
class CephContext;
@@ -44,7 +44,7 @@ namespace ceph {
class PluginRegistry {
public:
CephContext *cct;
- Mutex lock;
+ ceph::mutex lock = ceph::make_mutex("PluginRegistery::lock");
bool loading;
bool disable_dlclose;
std::map<std::string,std::map<std::string,Plugin*> > plugins;
diff --git a/src/test/compressor/test_compression.cc b/src/test/compressor/test_compression.cc
index 48103ab996a..2961b2bdb6b 100644
--- a/src/test/compressor/test_compression.cc
+++ b/src/test/compressor/test_compression.cc
@@ -396,7 +396,7 @@ TEST(CompressionPlugin, all)
EXPECT_EQ(0, factory->factory(&compressor, &ss));
EXPECT_TRUE(compressor.get());
{
- Mutex::Locker l(reg->lock);
+ std::lock_guard l(reg->lock);
EXPECT_EQ(-ENOENT, reg->remove("compressor", "does not exist"));
EXPECT_EQ(0, reg->remove("compressor", "example"));
EXPECT_EQ(0, reg->load("compressor", "example"));