Posting Module
Applies changes posted from foreign threads.
Each thread owns its ambient graph (created lazily on first use); the
owner thread of a graph is the thread that created it. All reads and
writes happen there. Foreign threads may only call Post on
changeable values (or the collection post functions); the post lands in
the node's own graph ring. Pending posts are applied automatically at the
start of the next graph operation on the owner thread, as one batch with
one notification delivery. No pump call is required.
Every posted source is applied at most once per batch, with the last posted value
winning. The source equality check still applies, so posting an equal value does
not mark. Posting.pump() forces application at a chosen boundary and is
cheap when the queue is empty; it allocates nothing.
Example
// worker thread
cval.Post(health - 1)
// owner thread: the next read applies the post automatically
let h = AVal.getValue health
Functions and values
| Function or value |
Description
|
Full Usage:
pump ()
Parameters:
unit
|
Applies all pending posted changes now. Optional: pending posts are applied automatically at the next graph operation. Use this to choose an explicit batch boundary (for example, once per frame). Must be called on the owner thread.
|
Mibo