Table of Contents

Class HostLock

Namespace
Valheim.Testing.GameSessions
Assembly
Valheim.Testing.GameSessions.dll

An exclusive lock on one host, held by one run. Dispose releases it; a release that cannot be proven throws HostLockException, because a failed teardown is a failure to report. Call ReleaseAsync(CancellationToken) to inspect it instead.

public sealed class HostLock
Inheritance
object
HostLock

Properties

HostName

public string HostName { get; }

Property Value

string

Owner

The exact claimant in the lock: the owner given to AcquireLockAsync plus a unique id for this acquisition.

public string Owner { get; }

Property Value

string

Path

public string Path { get; }

Property Value

string

Methods

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

ReleaseAsync(CancellationToken)

Removes the lock if it still names Owner. Only the first call acts.

public Task<HostLockResult> ReleaseAsync(CancellationToken cancellation = default)

Parameters

cancellation CancellationToken

Returns

Task<HostLockResult>