Module Bogue.Sync

module Sync: sig .. end

Synchronized execution queue.

Any action can be pushed to this FIFO queue, in order to be executed by Bogue's main loop at the start of the next graphical frame.

For any action that is not super urgent, it is a good idea to use this `Sync` module, instead of launching the action directly from a thread that may be difficult to control. In this way, we ensure that the action is not executed in the middle of rendering the graphics, or between various modifications of the board (events, keyboard focus, etc.).

Dependency graph

val push : (unit -> unit) -> unit

push action registers the action to be executed by the mainloop at the start of the next frame, or at a subsequent frame if the queue is already large.

Warning: the action should not call Sync.push itself, otherwise this will result in a deadlock.