Add shutdown detection
The maxscale_is_shutting_down function is used to detect when MaxScale should stop. This fixes a race condition in the code where the workers has not yet been initialized but a termination signal has been received. It also replaces the misuse of the service_should_stop variable with a proper function.
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
#include <ini.h>
|
||||
#include <sys/stat.h>
|
||||
#include <maxbase/atomic.h>
|
||||
#include <maxscale/maxscale.h>
|
||||
#include <maxbase/worker.hh>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/dcb.h>
|
||||
@ -328,7 +329,7 @@ static bool conversion_task_ctl(Avro *inst, bool start)
|
||||
{
|
||||
bool rval = false;
|
||||
|
||||
if (!service_should_stop)
|
||||
if (!maxscale_is_shutting_down())
|
||||
{
|
||||
Worker* worker = static_cast<Worker*>(mxs_rworker_get(MXS_RWORKER_MAIN));
|
||||
std::unique_ptr<ConversionCtlTask> task(new (std::nothrow) ConversionCtlTask(inst, start));
|
||||
|
Reference in New Issue
Block a user