Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
main.cc File Reference
#include <curl/curl.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include <atomic>
#include <chrono>
#include <csignal>
#include <filesystem>
#include <memory>
#include <nlohmann/json.hpp>
#include <string>
#include <utility>
#include "cert_updater.h"
#include "comm/base.h"
#include "comm/soem_fieldbus_driver.h"
#include "core/platform.h"
#include "core/version.h"
#include "example/example_routes.h"
#include "game_loop.h"
#include "http_server.h"
#include "node/device_manager.h"
#include "node/monitoring_manager.h"
#include "node/process_data_cyclic_task.h"
#include "options.h"
#include "ring_log_sink.h"
#include "ws_server.h"
Include dependency graph for main.cc:

Functions

int main (int argc, char **argv)
 Motion Master entry point: parse options, start subsystems, run the RT loop.
 

Variables

static std::atomic< GameLoop * > gGameLoop {nullptr}
 Signal-handler target for SIGINT/SIGTERM; set before run(), cleared after.
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Motion Master entry point: parse options, start subsystems, run the RT loop.

Initialises the HTTP/WebSocket server and game loop, installs SIGINT/SIGTERM handlers, then blocks on GameLoop::run() — the main thread IS the RT thread. Returns only after stop() is signalled and all subsystems are torn down.

Parameters
argcArgument count from the OS.
argvArgument vector from the OS.
Returns
0 on clean shutdown.

Variable Documentation

◆ gGameLoop

std::atomic<GameLoop*> gGameLoop {nullptr}
static

Signal-handler target for SIGINT/SIGTERM; set before run(), cleared after.

Atomic rather than a plain pointer because the handler reads it concurrently with the main thread's writes. A signal handler may only access lock-free atomic objects, and std::atomic<GameLoop*> is always lock-free, so the load below is well-defined.