OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Classes | Public Types | Public Attributes | List of all members
EngineControlState Class Reference

#include <EngineControlState.h>

Classes

struct  TerminationException
 

Public Types

using ControlRoutine = std::function< void(EngineController *)>
 
using GameRoutine = std::function< void()>
 

Public Attributes

std::queue< ControlRoutinecontrolRoutineQueue
 
bool terminating = false
 
std::queue< std::unique_ptr< PlatformEvent > > postedEvents
 
GameRoutine gameRoutine
 
EngineControlSide currentSide = SIDE_GAME
 
std::mutex mutex
 
IndexedArray< std::condition_variable, SIDE_GAME, SIDE_CONTROLwakeEvents
 

Member Typedef Documentation

◆ ControlRoutine

using EngineControlState::ControlRoutine = std::function<void(EngineController *)>

◆ GameRoutine

using EngineControlState::GameRoutine = std::function<void()>

Member Data Documentation

◆ controlRoutineQueue

std::queue<ControlRoutine> EngineControlState::controlRoutineQueue

Queue of control routines to run, these are added from the main thread and are consumed & run in control thread. Routines are removed from the queue only once they're finished.

◆ currentSide

EngineControlSide EngineControlState::currentSide = SIDE_GAME

Which thread is currently active.

◆ gameRoutine

GameRoutine EngineControlState::gameRoutine

A way to run some code in the main thread w/o really leaving the control routine. If this function is valid, yielding execution from the control thread will run it w/o proceeding to the next frame, and then switch right back into the control thread. It is set in control thread and cleared in the main thread.

Exception propagation from the control thread to the main thread is done with a game routine.

◆ mutex

std::mutex EngineControlState::mutex

This mutex protects everything. Game thread & control thread can run ONLY after locking it, and thus cannot run in parallel.

◆ postedEvents

std::queue<std::unique_ptr<PlatformEvent> > EngineControlState::postedEvents

Posted events, these are added from the control thread and are then consumed in the main thread.

◆ terminating

bool EngineControlState::terminating = false

Flag denoting that EngineControlComponent is being destroyed and it's time to terminate the control thread. It is set from the main thread.

◆ wakeEvents

IndexedArray<std::condition_variable, SIDE_GAME, SIDE_CONTROL> EngineControlState::wakeEvents

Condvars to wake up control/game threads.


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