GGUI/Public/MutationQueue.h file

MutationQueue: how threads other than the UI update change a UI tree.

NodeStorage has a single writer, the UI update. Every other thread pushes requests here (lock-free, never blocks) and the UI update applies them at the start of its frame. Same idea as the engine's spawn handshake.

  • Requests from one thread are applied in the order that thread made them.
  • A request that is no longer valid when applied (node destroyed, a move that would create a cycle) is rejected and counted, never half-applied.
  • The queue is bounded. A push onto a full queue returns false and is counted.

Structural requests refer to existing nodes. Anything else (creating nodes, building a subtree) is an Invoke: a small function run in the UI update with the storage. Data too big to capture (text, item lists) travels in a pooled buffer (InvokeWith).

Namespaces

namespace GGUI

Classes

class GGUI::MutationQueue
Changes to a node tree requested from any thread, applied by the UI update. See the file description.