If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit 32b78cdb authored by Tobias WEBER's avatar Tobias WEBER

debugging plugin unloading

parent aa29da02
......@@ -12,9 +12,9 @@ cmake_minimum_required(VERSION 3.0)
set(BUILD_FOR_MINGW FALSE)
#set(BUILD_FOR_MINGW TRUE)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_BUILD_TYPE Release)
#set(CMAKE_BUILD_TYPE Debug)
#set(CMAKE_CXX_STANDARD 11)
#set(BUILD_SHARED_LIBS TRUE)
set(USE_TR1_FUNCS FALSE)
......
......@@ -36,6 +36,12 @@ SqwPy::SqwPy(const std::string& strFile) : m_pmtx(std::make_shared<std::mutex>()
if(!bInited)
{
::Py_InitializeEx(0);
if(!::Py_IsInitialized())
{
tl::log_err("Cannot initialise Python interpreter.");
return;
}
std::string strPy = Py_GetVersion();
tl::find_all_and_replace(strPy, std::string("\n"), std::string(", "));
tl::log_debug("Initialised Python interpreter version ", strPy, ".");
......@@ -106,6 +112,9 @@ SqwPy::SqwPy(const std::string& strFile) : m_pmtx(std::make_shared<std::mutex>()
SqwPy::~SqwPy()
{
tl::log_debug("Unloading Python interpreter.");
Py_FinalizeEx();
tl::log_debug("Unloaded Python interpreter.");
}
......
......@@ -100,7 +100,7 @@ std::vector<std::tuple<std::string, std::string>> get_sqw_names()
std::get<0>(tup) = val.first;
std::get<1>(tup) = std::get<1>(val.second);
vec.push_back(std::move(tup));
vec.emplace_back(std::move(tup));
}
std::sort(vec.begin(), vec.end(), [](const t_tup& tup0, const t_tup& tup1) -> bool
......@@ -141,8 +141,29 @@ static std::vector<std::shared_ptr<so::shared_library>> g_vecMods;
void unload_sqw_plugins()
{
for(auto& pMod : g_vecMods)
{
std::function<t_fkt_info> fktInfo =
pMod->get<t_pfkt_info>("takin_sqw_info");
if(fktInfo)
{
auto tupInfo = fktInfo();
const std::string& strModIdent = std::get<1>(tupInfo);
tl::log_debug("Unloading plugin: ", strModIdent, ".");
// remove module from map
auto iterMod = g_mapSqw.find(strModIdent);
if(iterMod != g_mapSqw.end())
g_mapSqw.erase(iterMod);
}
pMod->unload();
pMod.reset();
//tl::log_debug("Unloaded plugin.");
}
g_vecMods.clear();
tl::log_debug("Unloaded all plugins.");
}
void load_sqw_plugins()
......@@ -285,7 +306,7 @@ bool load_sqw_params(SqwBase* pSqw,
SqwBase::t_var var;
std::get<0>(var) = strChild;
std::get<2>(var) = *opVal;
vecVars.push_back(std::move(var));
vecVars.emplace_back(std::move(var));
}
boost::optional<std::string> opErr =
......@@ -296,7 +317,7 @@ bool load_sqw_params(SqwBase* pSqw,
std::get<0>(varFit) = strChild;
std::get<1>(varFit) = opErr ? *opErr : "0";
std::get<2>(varFit) = opFit ? *opFit : 0;
vecVarsFit.push_back(std::move(varFit));
vecVarsFit.emplace_back(std::move(varFit));
}
pSqw->SetVars(vecVars);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment