PresentationLifetime class

Namespace Runic.Platform.Runtime · Runic.Platform.Runtime 0.7.0-preview.5

public sealed class PresentationLifetime : IAsyncDisposable

Inherits or implements IAsyncDisposable.

Owns one presentation generation, drains admitted operations and releases acquired resources.

Constructors

PresentationLifetime

public PresentationLifetime(Func<bool>? ownerAvailable = null, Guid? generation = null)

Creates a lifetime using a verified owner callback and optional shared generation.

Properties

Generation

public Guid Generation { get; }

The immutable presentation generation.

HasOwner

public bool HasOwner { get; }

Whether the verified owner is currently available.

IsClosing

public bool IsClosing { get; }

Whether shutdown has started.

Shutdown

public CancellationToken Shutdown { get; }

Signals shutdown before admitted operations are drained.

Methods

DisposeAsync

public ValueTask DisposeAsync()

Joins the single shared shutdown result.

StopAsync

public ValueTask StopAsync()

Starts shutdown and awaits operation drain and resource cleanup.

TryBeginOperation

public IDisposable? TryBeginOperation()

Admits work until shutdown; disposing the token signals that work and cleanup have finished.