PostSharpAPI ReferencePost­Sharp.​Patterns.​ThreadingThread­Aware­ExtensionsAcquire­Access­Async
Open sandboxFocus

ThreadAwareExtensions.AcquireAccessAsync Method

AcquireAccessAsync(IThreadAware, ObjectAccessLevel)

Asynchronously acquires access for a given object.

public static ConcurrentAccessAwaiter AcquireAccessAsync(this IThreadAware instance, ObjectAccessLevel objectAccessLevel)
Type Name Description
IThreadAware instance

The instance for which access is required.

ObjectAccessLevel objectAccessLevel

The level of access required.

Type Description

An ConcurrentAccessAwaiter object that can be used for awaiting for access.


This method is guaranteed to acquire the controller of the instance object. Invoking the AcquireAccessAsync(ObjectAccessLevel) method directly does not offer this guarantee, as the controller can be changed between the moment the ConcurrencyController property is retrieved and the moment the AcquireAccessAsync(ObjectAccessLevel) is invoked.