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

ThreadAwareExtensions.AcquireAccess Method

AcquireAccess(IThreadAware, ObjectAccessLevel)

Acquires access to given object and returns the ConcurrentAccessToken.

Declaration
public static ConcurrentAccessToken AcquireAccess(this IThreadAware instance, ObjectAccessLevel objectAccessLevel)
Parameters
Type Name Description
IThreadAware instance

The instance for which access is required.

ObjectAccessLevel objectAccessLevel

The level of access required.

Returns
Type Description
ConcurrentAccessToken

A ConcurrentAccessToken that should be disposed when access is no longer required.

AcquireAccess(IThreadAware, ObjectAccessLevel, ref ConcurrentAccessToken)

Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter.

Declaration
public static void AcquireAccess(this IThreadAware instance, ObjectAccessLevel objectAccessLevel, ref ConcurrentAccessToken concurrentAccessToken)
Parameters
Type Name Description
IThreadAware instance

The instance for which access is required.

ObjectAccessLevel objectAccessLevel

The level of access required.

ConcurrentAccessToken concurrentAccessToken

At output, a ConcurrentAccessToken that should be disposed when access is no longer required.