MXS-1914: Move maxscale_shutdown() into the core

The core library now contains the maxscale_shutdown() command. This makes
it possible to resolve all symbols at link time even for administrative
modules.
This commit is contained in:
Markus Mäkelä
2018-06-16 05:29:50 +03:00
parent df24f09ce5
commit 13893cca3d
4 changed files with 61 additions and 70 deletions

View File

@ -14,7 +14,11 @@
#include <maxscale/maxscale.h>
#include <time.h>
#include <maxscale/worker.hh>
#include "internal/maxscale.h"
#include "internal/service.h"
static time_t started;
@ -32,3 +36,18 @@ int maxscale_uptime()
{
return time(0) - started;
}
int maxscale_shutdown()
{
static int n_shutdowns = 0;
int n = atomic_add(&n_shutdowns, 1);
if (n == 0)
{
service_shutdown();
mxs::Worker::shutdown_all();
}
return n + 1;
}