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:
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user