MXS-1775 Thread starting is now handled by MonitorInstance

This commit is contained in:
Johan Wikman
2018-05-16 12:40:50 +03:00
parent adb7f156d6
commit c7eb0a9958
12 changed files with 48 additions and 243 deletions

View File

@ -47,42 +47,6 @@ void GRMon::destroy()
delete this;
}
bool GRMon::start(const MXS_CONFIG_PARAMETER* params)
{
bool started = false;
ss_dassert(!m_shutdown);
ss_dassert(!m_thread);
if (!m_checked)
{
if (!has_sufficient_permissions())
{
MXS_ERROR("Failed to start monitor. See earlier errors for more information.");
}
else
{
m_checked = true;
}
}
if (m_checked)
{
configure(params);
if (thread_start(&m_thread, &maxscale::MonitorInstance::main, this, 0) == NULL)
{
;
}
else
{
started = true;
}
}
return started;
}
bool GRMon::has_sufficient_permissions() const
{
return true;
@ -90,8 +54,8 @@ bool GRMon::has_sufficient_permissions() const
void GRMon::configure(const MXS_CONFIG_PARAMETER* params)
{
// TODO: Turn MonitorInstance::m_script into a std::string and remove GRMon::m_script
m_script = config_get_string(params, "script");
m_events = config_get_enum(params, "events", mxs_monitor_event_enum_values);
m_master = NULL;
}