Table of Contents

Interface IGameThread

Namespace
BSGameLib.Game
Assembly
BSGameLib.Game.dll

Runs work on the game's thread, at the start of the next frame.

public interface IGameThread

Remarks

Networking hands packet handlers to the game on its receive threads, beside the game loop, so a handler that touches game state races with the loop. Post the change here instead: the loop runs everything posted before a frame once, before that frame's update steps. Safe to call from any thread, including the game's own.

Methods

Post(Action)

Queues action to run on the game's thread at the next frame. An action that throws is logged and the rest still run; one posted during a frame's drain runs the frame after.

void Post(Action action)

Parameters

action Action