MXS-1775 Inherit MariaDBMonitor from mxs::MonitorInstance
Start/stop now provided by MonitorInstance. The thread main function is now virtual and overriden by MariaDBMonitor. Some additional refactoring is necessary in order to be able to allow MonitorInstance to handle the main loop.
This commit is contained in:
@ -103,6 +103,16 @@ protected:
|
||||
const std::string& script() const { return m_script; }
|
||||
uint64_t events() const { return m_events; }
|
||||
|
||||
/**
|
||||
* @brief Should the monitor shut down?
|
||||
*
|
||||
* @return True, if the monitor should shut down, false otherwise.
|
||||
*/
|
||||
bool should_shutdown() const
|
||||
{
|
||||
return atomic_load_int32(&m_shutdown) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the monitor.
|
||||
*
|
||||
@ -165,6 +175,11 @@ protected:
|
||||
*/
|
||||
virtual void tick();
|
||||
|
||||
/**
|
||||
* TODO: Temporarily virtual so that MariaDBMonitor can override.
|
||||
*/
|
||||
virtual void main();
|
||||
|
||||
MXS_MONITOR* m_monitor; /**< The generic monitor structure. */
|
||||
MXS_MONITORED_SERVER* m_master; /**< Master server */
|
||||
|
||||
@ -177,8 +192,6 @@ private:
|
||||
uint64_t m_events; /**< Enabled monitor events. */
|
||||
Semaphore m_semaphore; /**< Semaphore for synchronizing with monitor thread. */
|
||||
|
||||
void main();
|
||||
|
||||
static void main(void* pArg);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user