Improve main thread detection
Now properly checks if configuration and diagnostics functions are ran in either main() or in the admin worker. This is useful for debugging and enforcing thread safety. Also, monitors are now started and stopped in the admin worker.
This commit is contained in:
@ -46,6 +46,7 @@
|
||||
|
||||
#include "internal/config.hh"
|
||||
#include "internal/externcmd.hh"
|
||||
#include "internal/maxscale.hh"
|
||||
#include "internal/monitor.hh"
|
||||
#include "internal/modules.hh"
|
||||
#include "internal/server.hh"
|
||||
@ -1212,8 +1213,7 @@ string Monitor::get_server_monitor(const SERVER* server)
|
||||
|
||||
bool Monitor::is_admin_thread()
|
||||
{
|
||||
mxb::Worker* current = mxb::Worker::get_current();
|
||||
return current == nullptr || current == mxs_rworker_get(MXS_RWORKER_MAIN);
|
||||
return running_in_admin_thread();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user