pgLab/pglab/plugin_support/PluginRegister.cpp
eelke 15bee33076 Made step to remove ASyncWindow in favour of usage of Future and FutureWatcher.
This should allow concurrency in the plugins to be independent from their container.

Contains also some work on the system for registering plugins.
2018-12-30 15:46:15 +01:00

29 lines
776 B
C++

#include "PluginRegister.h"
#include "plugin_support/PluginModule.h"
#include <QDebug>
PluginRegister* PluginRegister::s_pluginRegister;
PluginRegister* PluginRegister::getInstance()
{
static std::mutex m;
// check if set without locking first (in most cases it will be set and it will never be unset) so locking the mutex everytime
// is a waist of time.
if (!s_pluginRegister) {
// not set then lock
std::lock_guard<std::mutex> guard(m);
// recheck in case someone else just set it
if (!s_pluginRegister) {
s_pluginRegister = new PluginRegister;
}
}
return s_pluginRegister;
}
PluginRegister::PluginRegister() = default;
void PluginRegister::registerModule(PluginModuleSPtr module)
{
qDebug() << "Register called for " << module->identifier();
}