Partager via


AsyncReaderWriterResourceLock<TMoniker,TResource>.PrepareResourceForExclusiveAccessAsync Method

Definition

Prepares a resource for access by one thread.

protected:
 abstract System::Threading::Tasks::Task ^ PrepareResourceForExclusiveAccessAsync(TResource resource, Microsoft::VisualStudio::Threading::AsyncReaderWriterResourceLock<TMoniker, TResource>::LockFlags lockFlags, System::Threading::CancellationToken cancellationToken);
protected abstract System.Threading.Tasks.Task PrepareResourceForExclusiveAccessAsync (TResource resource, Microsoft.VisualStudio.Threading.AsyncReaderWriterResourceLock<TMoniker,TResource>.LockFlags lockFlags, System.Threading.CancellationToken cancellationToken);
abstract member PrepareResourceForExclusiveAccessAsync : 'Resource * Microsoft.VisualStudio.Threading.AsyncReaderWriterResourceLock<'Moniker, 'Resource (requires 'Resource : null)>.LockFlags * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected MustOverride Function PrepareResourceForExclusiveAccessAsync (resource As TResource, lockFlags As AsyncReaderWriterResourceLock(Of TMoniker, TResource).LockFlags, cancellationToken As CancellationToken) As Task

Parameters

resource
TResource

The resource to prepare.

lockFlags
AsyncReaderWriterResourceLock<TMoniker,TResource>.LockFlags

The aggregate of all flags from the active and nesting locks.

cancellationToken
CancellationToken

The token whose cancellation signals lost interest in the resource.

Returns

A task whose completion signals the resource has been prepared.

Remarks

This is invoked on a resource when it is initially access for exclusive access, but only when transitioning from no access -- it is not invoked when transitioning from concurrent access to exclusive access.

Applies to