Logo Mibo

ChangeableValue<'T> Type

Constructors

Constructor Description

ChangeableValue(initial)

Full Usage: ChangeableValue(initial)

Parameters:
    initial : 'T

Returns: ChangeableValue<'T>
initial : 'T
Returns: ChangeableValue<'T>

Instance members

Instance member Description

this.GetValue

Full Usage: this.GetValue

Returns: 'T

Gets the current value and registers a dependency for the calling computation (FDA cval.GetValue parity; no token here).

Returns: 'T

this.Post

Full Usage: this.Post

Parameters:
    newValue : 'T

Posts a new value from any thread. The value is applied automatically at the next graph operation on the owner thread — no pump call is needed. Several posts to this source before the application collapse to the last value. The source equality check applies at application, so posting an equal value does not mark. Allocates nothing.

Post is the only operation a foreign thread may call on a graph. It never touches graph state: it writes the typed pending field and, if the source is not queued yet, pushes the source onto the bounded post ring. If the ring is full, Post waits (spin with yield backoff) until the owner drains it; items are never dropped.

The pending value crosses threads as a plain (non-atomic) write. 'T must be a reference type or a struct no larger than a machine word: larger structs can tear (the owner may apply a value mixed from two posts).

newValue : 'T
Example

 // worker thread
 health.Post(healthValue - 1)
 // owner thread: the next read applies the post automatically
 let h = AVal.getValue health
val h: obj

this.Set

Full Usage: this.Set

Parameters:
    newValue : 'T

newValue : 'T

this.UpdateTo

Full Usage: this.UpdateTo

Parameters:
    newValue : 'T

Returns: bool

Sets the current value and returns whether the value changed (FDA cval.UpdateTo parity). A write with an equal value returns false and marks nothing.

newValue : 'T
Returns: bool

this.Value

Full Usage: this.Value

Returns: 'T

Gets or sets the current value (FDA cval.Value parity). The setter routes through Set: inside a transaction the write is deferred to commit. The getter returns the raw current value; it does not register a dependency (use GetValue for that).

Returns: 'T

Type something to start searching.