qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches

The main controller for the QB Actor Framework engine. More...

#include <Main.h>

Public Types

using ActorIdList = CoreInitializer::ActorBuilder::ActorIdList

Public Member Functions

 Main () noexcept
 Default constructor.
 ~Main () noexcept
 Destructor.
void start (bool async=true) noexcept
 Start the engine and its VirtualCore worker threads.
bool hasError () const noexcept
 Check if any VirtualCore encountered an error and terminated prematurely.
void join ()
 Wait for the engine and all its VirtualCore threads to terminate.
template<typename _Actor, typename... _Args>
ActorId addActor (CoreId index, _Args &&...args)
 Add a new actor to a specified VirtualCore before the engine starts.
CoreInitializercore (CoreId index)
 Get the CoreInitializer for a specific VirtualCore index.
void setLatency (uint64_t latency=0)
 Set the default event loop latency for all VirtualCores.
qb::CoreIdSet usedCoreSet () const
 Get the set of CoreIds that are currently configured to be used by the engine.

Static Public Member Functions

static void stop () noexcept
 Stop the engine and all its VirtualCores gracefully.
static void registerSignal (int signum) noexcept
 Register a system signal to be handled by the engine (results in graceful shutdown).
static void unregisterSignal (int signum) noexcept
 Unregister a previously registered system signal from engine handling.
static void ignoreSignal (int signum) noexcept
 Ignore a system signal, preventing the engine or default OS handler from processing it.

Detailed Description

The main controller for the QB Actor Framework engine.

This class is the primary entry point for initializing, configuring, and running the actor system. It manages the lifecycle of VirtualCores (worker threads), provides an interface for adding actors to these cores, and handles system-wide concerns like signal handling and overall system start/stop.

Constructor & Destructor Documentation

◆ Main()

qb::Main::Main ( )
noexcept

Default constructor.

Initializes the main engine structure.

◆ ~Main()

qb::Main::~Main ( )
noexcept

Destructor.

Ensures graceful shutdown of the engine if running.