PluginRegistry::PluginRegistry(CephContext *cct) :
cct(cct),
- lock("PluginRegistry::lock"),
loading(false),
disable_dlclose(false)
{
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);
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;
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);
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;
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
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();
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"));