Table of Contents

Struct AsyncReaderWriterResourceLock<TMoniker, TResource>.ResourceReleaser

Namespace
Microsoft.VisualStudio.Threading
Assembly
Microsoft.VisualStudio.Threading.dll

A value whose disposal releases a held lock.

public readonly struct AsyncReaderWriterResourceLock<TMoniker, TResource>.ResourceReleaser : IDisposable, IAsyncDisposable
Implements
Inherited Members

Methods

Dispose()

Releases the lock.

public void Dispose()

DisposeAsync()

Releases the lock.

public ValueTask DisposeAsync()

Returns

ValueTask

GetResourceAsync(TMoniker, CancellationToken)

Gets the lock protected resource.

public Task<TResource> GetResourceAsync(TMoniker resourceMoniker, CancellationToken cancellationToken = default)

Parameters

resourceMoniker TMoniker

The identifier for the protected resource.

cancellationToken CancellationToken

A token whose cancellation signals lost interest in the protected resource.

Returns

Task<TResource>

A task whose result is the resource.

ReleaseAsync()

Asynchronously releases the lock. Dispose should still be called after this.

public Task ReleaseAsync()

Returns

Task

Remarks

Rather than calling this method explicitly, use the C# 8 "await using" syntax instead.