package bogue
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=991bc2e85df38feb23bddf84addd758d
sha512=8b777f7b479946528626c4112bf45600bee9aed0d94742e3eed0659f9a0517e41d0eaf398299920fd5b9f86065bd0e24035662d2df36f24f6a044c78e61dee01
doc/bogue/Bogue/Sync/index.html
Module Bogue.SyncSource
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
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 may also call push itself, but since there is only one execution queue, the second action will be executed only after the first action terminates. For instance this program:
Sync.push (fun () ->
print_endline "push 1";
Sync.push (fun () ->
print_endline "push 2";
print_endline "end 2");
print_endline "end 1");
print_endline "Creating board";
W.label "Checking sync... see console"
|> L.resident
|> Main.of_layout
|> Main.runwill print:
Creating board push 1 end 1 push 2 end 2