GraphHost
[<Class>]
type GraphHost<'App> =
member GraphThreadId: int
member Dispose () : unit
member Invoke<'T> (work: 'App -> 'T, cancellationToken: CancellationToken) : Task<'T>
member Invoke<'T> (work: 'App -> 'T) : Task<'T>| Assembly | Ranvier.Mcp |
| Implements | IDisposable |
| Attributes | [<Sealed>] |
A Guarded graph on a dedicated thread, and the value its setup built. Invoke is the only entry from another thread.
The graph's inbox drains on the host thread through a SynchronizationContextDispatcher, so Graph.DispatchAsync completes without a pump. The graph is ambient on the host thread for its whole life. A node touched from any other thread raises InvalidOperationException.
Properties
Methods
member Dispose () : unit
member Dispose () : unitDisposes the graph on the host thread and stops the thread, after any work already running. Pending invocations fault with ObjectDisposedException. Idempotent.
Called from another thread, it returns once the host thread has stopped.
member Invoke<'T> (work: 'App -> 'T, cancellationToken: CancellationToken) : Task<'T>
member Invoke<'T> (work: 'App -> 'T, cancellationToken: CancellationToken) : Task<'T>Invoke, cancelled instead when cancellationToken is cancelled before the work starts.
member Invoke<'T> (work: 'App -> 'T) : Task<'T>
member Invoke<'T> (work: 'App -> 'T) : Task<'T>Runs work on the host thread with the setup's value, through Graph.DispatchAsync, and returns a task that completes with its result after the work and the effects it triggers have run.
The task faults with the work's exception when the work throws. After disposal begins, the task faults with ObjectDisposedException and the work does not run, including work queued before disposal. Continuations run on the thread pool. Called on the host thread, the work runs before Invoke returns.