Ferrous API Reference

All Types / Ferrous.Concurrency

class AsyncRwLock<T>

public sealed class AsyncRwLock<T> : IDisposable

An async-capable data-owning reader-writer lock inspired by tokio::sync::RwLock<T>. Compiled with .NET 11 runtime async (runtime-async=on) on net11.0.

Type Parameters
T
The type of the protected value.

Constructors

public AsyncRwLock(T initialValue)

Initializes a new AsyncRwLock<T> owning initialValue.

Methods

public async ValueTask<AsyncReadGuard<T>> ReadAsync(CancellationToken cancellationToken = default)
[MustUse]

Asynchronously acquires shared read access.

public async ValueTask<AsyncWriteGuard<T>> WriteAsync(CancellationToken cancellationToken = default)
[MustUse]

Asynchronously acquires exclusive write access.

public void Dispose()