Construct diagnostics results in the monitor thread

MariaDBMonitor diagnostics printing is unsafe as some of the read
fields are arrays. To be on the safe side, the fields are now read
in the monitor worker thread.

Since diagnostics must work even for stopped monitors, a worker task
is used. In practice, it usually runs when the monitor is sleeping.
This commit is contained in:
Esa Korhonen
2018-06-28 16:08:52 +03:00
parent 590df89dbc
commit 862ae099b0
5 changed files with 138 additions and 16 deletions

View File

@ -131,6 +131,15 @@ inline std::vector<std::string> strtok(std::string str, const char* delim)
return rval;
}
/**
* Format parameters to a string. Uses printf-formatting.
*
* @param format Format string
* @param ... Items to convert according to format string
* @return The result string
*/
std::string string_printf(const char* format, ...) mxb_attribute((format (printf, 1, 2)));
/**
* @class CloserTraits utils.hh <maxscale/utils.hh>
*