AsyncReaderWriterResourceLock<TMoniker,TResource> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A non-blocking lock that allows concurrent access, exclusive access, or concurrent with upgradeability to exclusive access, making special allowances for resources that must be prepared for concurrent or exclusive access.
generic <typename TMoniker, typename TResource>
where TResource : classpublic ref class AsyncReaderWriterResourceLock abstract : Microsoft::VisualStudio::Threading::AsyncReaderWriterLock
public abstract class AsyncReaderWriterResourceLock<TMoniker,TResource> : Microsoft.VisualStudio.Threading.AsyncReaderWriterLock where TResource : class
type AsyncReaderWriterResourceLock<'Moniker, 'Resource (requires 'Resource : null)> = class
inherit AsyncReaderWriterLock
Public MustInherit Class AsyncReaderWriterResourceLock(Of TMoniker, TResource)
Inherits AsyncReaderWriterLock
Type Parameters
- TMoniker
The type of the moniker that identifies a resource.
- TResource
The type of resource issued for access by this lock.
- Inheritance
Constructors
AsyncReaderWriterResourceLock<TMoniker,TResource>() |
Initializes a new instance of the AsyncReaderWriterResourceLock<TMoniker,TResource> class. |
AsyncReaderWriterResourceLock<TMoniker,TResource>(Boolean) |
Initializes a new instance of the AsyncReaderWriterResourceLock<TMoniker,TResource> class. |
AsyncReaderWriterResourceLock<TMoniker,TResource>(JoinableTaskContext, Boolean) |
Initializes a new instance of the AsyncReaderWriterResourceLock<TMoniker,TResource> class. |
Properties
AmbientLock |
Gets the lock held by the caller's execution context. (Inherited from AsyncReaderWriterLock) |
CanCurrentThreadHoldActiveLock |
Gets a value indicating whether the current thread is allowed to hold an active lock. (Inherited from AsyncReaderWriterLock) |
CaptureDiagnostics |
Gets or sets a value indicating whether additional resources should be spent to collect information that would be useful in diagnosing deadlocks, etc. (Inherited from AsyncReaderWriterLock) |
Completion |
Gets a task whose completion signals that this lock will no longer issue locks. (Inherited from AsyncReaderWriterLock) |
DeadlockCheckTimeout |
Gets a time delay to check whether pending writer lock and reader locks forms a deadlock. (Inherited from AsyncReaderWriterLock) |
IsAnyLockHeld |
Gets a value indicating whether any kind of lock is held by the caller and can be immediately used given the caller's context. (Inherited from AsyncReaderWriterLock) |
IsAnyPassiveLockHeld |
Gets a value indicating whether any kind of lock is held by the caller without regard to the lock compatibility of the caller's context. (Inherited from AsyncReaderWriterLock) |
IsPassiveReadLockHeld |
Gets a value indicating whether a read lock is held by the caller without regard to the lock compatibility of the caller's context. (Inherited from AsyncReaderWriterLock) |
IsPassiveUpgradeableReadLockHeld |
Gets a value indicating whether an upgradeable read lock is held by the caller without regard to the lock compatibility of the caller's context. (Inherited from AsyncReaderWriterLock) |
IsPassiveWriteLockHeld |
Gets a value indicating whether a write lock is held by the caller without regard to the lock compatibility of the caller's context. (Inherited from AsyncReaderWriterLock) |
IsReadLockHeld |
Gets a value indicating whether the caller holds a read lock. (Inherited from AsyncReaderWriterLock) |
IsUnsupportedSynchronizationContext |
Gets a value indicating whether the current SynchronizationContext is one that is not supported by this lock. (Inherited from AsyncReaderWriterLock) |
IsUpgradeableReadLockHeld |
Gets a value indicating whether the caller holds an upgradeable read lock. (Inherited from AsyncReaderWriterLock) |
IsWriteLockHeld |
Gets a value indicating whether the caller holds a write lock. (Inherited from AsyncReaderWriterLock) |
NoMessagePumpSynchronizationContext |
Gets a SynchronizationContext which, when applied, suppresses any message pump that may run during synchronous blocks of the calling thread. (Inherited from AsyncReaderWriterLock) |
SyncObject |
Gets the object used to synchronize access to this instance's fields. (Inherited from AsyncReaderWriterLock) |
Methods
Complete() |
Causes new top-level lock requests to be rejected and the Completion task to transition to a completed state after any issued locks have been released. (Inherited from AsyncReaderWriterLock) |
Dispose() | (Inherited from AsyncReaderWriterLock) |
Dispose(Boolean) |
Disposes managed and unmanaged resources held by this instance. (Inherited from AsyncReaderWriterLock) |
GetAggregateLockFlags() |
Returns the aggregate of the lock flags for all nested locks. |
GetHangReport() |
Contributes data for a hang report. (Inherited from AsyncReaderWriterLock) |
GetResourceAsync(TMoniker, CancellationToken) |
Retrieves the resource with the specified moniker. |
GetTaskSchedulerForReadLockRequest() |
Get the task scheduler to execute the continuation when the lock is acquired. AsyncReaderWriterLock uses a special SynchronizationContext to handle exclusive locks, and will ignore task scheduler provided, so this is only used in a read lock scenario. This method is called within the execution context to wait the read lock, so it can pick up TaskScheduler based on the current execution context. Note: the task scheduler is only used, when the lock is issued later. If the lock is issued immediately when CanCurrentThreadHoldActiveLock returns true, it will be ignored. (Inherited from AsyncReaderWriterLock) |
GetTaskSchedulerToPrepareResourcesForConcurrentAccess(TResource) |
Gets a task scheduler to prepare a resource for concurrent access. |
HideLocks() |
Prevents use or visibility of the caller's lock(s) until the returned value is disposed. (Inherited from AsyncReaderWriterLock) |
LockStackContains(AsyncReaderWriterLock+LockFlags, AsyncReaderWriterLock+LockHandle) |
Checks whether the aggregated flags from all locks in the lock stack satisfy the specified flag(s). (Inherited from AsyncReaderWriterLock) |
OnBeforeExclusiveLockReleasedAsync() |
Fired when the last write lock is about to be released. (Inherited from AsyncReaderWriterLock) |
OnBeforeLockReleasedAsync(Boolean, AsyncReaderWriterLock+LockHandle) |
Fired when any lock is being released. (Inherited from AsyncReaderWriterLock) |
OnBeforeWriteLockReleased(Func<Task>) |
Registers a callback to be invoked when the write lock held by the caller is about to be ultimately released (outermost write lock). (Inherited from AsyncReaderWriterLock) |
OnCriticalFailure(Exception) |
Invoked when the lock detects an internal error or illegal usage pattern that indicates a serious flaw that should be immediately reported to the application and/or bring down the process to avoid hangs or data corruption. (Inherited from AsyncReaderWriterLock) |
OnCriticalFailure(String) |
Invoked when the lock detects an internal error or illegal usage pattern that indicates a serious flaw that should be immediately reported to the application and/or bring down the process to avoid hangs or data corruption. (Inherited from AsyncReaderWriterLock) |
OnExclusiveLockReleasedAsync() |
Invoked after an exclusive lock is released but before anyone has a chance to enter the lock. |
OnUpgradeableReadLockReleased() |
Invoked when a top-level upgradeable read lock is released, leaving no remaining (write) lock. |
PrepareResourceForConcurrentAccessAsync(TResource, CancellationToken) |
Prepares a resource for concurrent access. |
PrepareResourceForExclusiveAccessAsync(TResource, AsyncReaderWriterResourceLock<TMoniker,TResource>.LockFlags, CancellationToken) |
Prepares a resource for access by one thread. |
ReadLockAsync(CancellationToken) |
Obtains a read lock, asynchronously awaiting for the lock if it is not immediately available. |
SetAllResourcesToUnknownState() |
Sets all the resources to be considered in an unknown state. |
SetResourceAsAccessed(Func<TResource,Object,Boolean>, Object) |
Marks any loaded resources as having been retrieved under a lock if they satisfy some predicate. |
SetResourceAsAccessed(TResource) |
Marks a resource as having been retrieved under a lock. |
UpgradeableReadLockAsync(AsyncReaderWriterLock+LockFlags, CancellationToken) |
Obtains a read lock, asynchronously awaiting for the lock if it is not immediately available. (Inherited from AsyncReaderWriterLock) |
UpgradeableReadLockAsync(AsyncReaderWriterResourceLock<TMoniker,TResource>.LockFlags, CancellationToken) |
Obtains a read lock, asynchronously awaiting for the lock if it is not immediately available. |
UpgradeableReadLockAsync(CancellationToken) |
Obtains an upgradeable read lock, asynchronously awaiting for the lock if it is not immediately available. |
WriteLockAsync(AsyncReaderWriterLock+LockFlags, CancellationToken) |
Obtains a write lock, asynchronously awaiting for the lock if it is not immediately available. (Inherited from AsyncReaderWriterLock) |
WriteLockAsync(AsyncReaderWriterResourceLock<TMoniker,TResource>.LockFlags, CancellationToken) |
Obtains a write lock, asynchronously awaiting for the lock if it is not immediately available. |
WriteLockAsync(CancellationToken) |
Obtains a write lock, asynchronously awaiting for the lock if it is not immediately available. |
Explicit Interface Implementations
IHangReportContributor.GetHangReport() |
Contributes data for a hang report. (Inherited from AsyncReaderWriterLock) |
Applies to
Thread Safety
This type is thread-safe for all members.