The bool loading data member of ErasureCodePluginRegistry is
set to true when a plugin is being loaded, to provide an observable side
effect for test purposes.
Signed-off-by: Loic Dachary <loic@dachary.org>
ErasureCodePluginRegistry ErasureCodePluginRegistry::singleton;
ErasureCodePluginRegistry::ErasureCodePluginRegistry() :
- lock("ErasureCodePluginRegistry::lock")
+ lock("ErasureCodePluginRegistry::lock"),
+ loading(false)
{
}
int r = 0;
ErasureCodePlugin *plugin = get(plugin_name);
if (plugin == 0) {
+ loading = true;
r = load(plugin_name, parameters, &plugin);
+ loading = false;
if (r != 0)
return r;
}
class ErasureCodePluginRegistry {
public:
Mutex lock;
+ bool loading;
std::map<std::string,ErasureCodePlugin*> plugins;
static ErasureCodePluginRegistry singleton;