Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
CyclicTask Class Referenceabstract

Interface for work executed once per game loop cycle. More...

#include <cyclic_task.h>

Inheritance diagram for CyclicTask:
[legend]

Public Member Functions

virtual ~CyclicTask ()=default
 Virtual destructor.
 
virtual void execute (const CycleContext &ctx)=0
 Called once per cycle, after process data has been exchanged and device parameters updated.
 

Detailed Description

Interface for work executed once per game loop cycle.

Implementations must be non-blocking and must not allocate heap memory or perform I/O on the calling thread. Any async work (e.g. pushing data to a WebSocket) must be handed off to another thread via a lock-free channel.

Tasks are registered with GameLoop::addTask() before run() is called and are owned by the caller (the composition root). GameLoop holds non-owning pointers, so a task must outlive every call to run().

Constructor & Destructor Documentation

◆ ~CyclicTask()

virtual CyclicTask::~CyclicTask ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ execute()

virtual void CyclicTask::execute ( const CycleContext ctx)
pure virtual

Called once per cycle, after process data has been exchanged and device parameters updated.

Must return before the next cycle deadline. Blocking here stalls the entire RT loop.

Parameters
ctxPer-cycle timing context (grid index + skipped count). Tasks that act only on the freshest state may ignore it.

Implemented in ProcessDataCyclicTask.


The documentation for this class was generated from the following file: