qb
2.0.0.0
C++17 Actor Framework
|
Handles pre-start configuration for a single VirtualCore. More...
#include <Main.h>
Classes | |
class | ActorBuilder |
Helper to fluently build multiple Actors for a CoreInitializer. More... |
Public Member Functions | |
CoreInitializer (CoreId index) | |
Constructor for CoreInitializer. | |
~CoreInitializer () noexcept | |
Destructor. | |
void | clear () noexcept |
Clears all registered actor factories for this initializer. | |
template<typename _Actor, typename... _Args> | |
ActorId | addActor (_Args &&...args) noexcept |
Create and add a new _Actor to this VirtualCore. | |
ActorBuilder | builder () noexcept |
Get an ActorBuilder for this CoreInitializer. | |
CoreInitializer & | setAffinity (CoreIdSet const &cores={}) noexcept |
Set the CPU affinity for the VirtualCore associated with this initializer. | |
CoreInitializer & | setLatency (uint64_t latency=0) noexcept |
Set the maximum event loop latency for the VirtualCore. | |
CoreId | getIndex () const noexcept |
Gets the CoreId associated with this initializer. | |
CoreIdSet const & | getAffinity () const noexcept |
Gets the currently configured CPU affinity set for this core. | |
uint64_t | getLatency () const noexcept |
Gets the currently configured maximum event loop latency (in ns) for this core. |
Handles pre-start configuration for a single VirtualCore.
This class allows setting up properties like core affinity, event loop latency, and adding initial actors to a VirtualCore before the main engine starts. Instances are typically obtained via Main::core(core_id).
|
explicit |
Constructor for CoreInitializer.
index | The CoreId this initializer is for. |
|
noexcept |
Destructor.
Cleans up actor factories.
|
noexcept |
Clears all registered actor factories for this initializer.
This removes any pending actor creation tasks that were added via addActor() or builder() but before the engine was started. Useful if re-configuration is needed before Main::start().
|
noexcept |
Create and add a new _Actor to this VirtualCore.
_Actor | DerivedActor type to create. |
_Args | Arguments to forward to the constructor of the _Actor. |
args | Arguments to forward to the _Actor's constructor. |
Creates a new _Actor instance scheduled to run on the VirtualCore associated with this CoreInitializer. Example:
|
nodiscardnoexcept |
Get an ActorBuilder for this CoreInitializer.
|
noexcept |
Set the CPU affinity for the VirtualCore associated with this initializer.
cores | A CoreIdSet specifying the set of physical CPU cores this VirtualCore thread should be allowed to run on. An empty set typically means default OS scheduling. |
|
noexcept |
Set the maximum event loop latency for the VirtualCore.
latency | The maximum time in nanoseconds the VirtualCore's event loop will wait if it hasn't received any core/IO events. Defaults to 0. |
|
nodiscardnoexcept |
Gets the CoreId associated with this initializer.
|
nodiscardnoexcept |
Gets the currently configured CPU affinity set for this core.
|
nodiscardnoexcept |
Gets the currently configured maximum event loop latency (in ns) for this core.