Fix monitor repurposing

The monitor active state is now modified under the same lock. This should
make creation and destruction of monitors deterministic.
This commit is contained in:
Markus Mäkelä
2017-08-04 13:07:58 +03:00
parent 1743f4c1b7
commit 05d185fc02
3 changed files with 8 additions and 6 deletions

View File

@ -841,11 +841,11 @@ bool runtime_create_monitor(const char *name, const char *module)
if (monitor_find(name) == NULL)
{
MXS_MONITOR *monitor = monitor_find_destroyed(name, module);
MXS_MONITOR *monitor = monitor_repurpose_destroyed(name, module);
if (monitor)
{
monitor->active = true;
MXS_DEBUG("Repurposed monitor '%s'", name);
}
else if ((monitor = monitor_alloc(name, module)) == NULL)
{