PostSharpAPI ReferencePost­Sharp.​Patterns.​ThreadingRead­Only­Thread­Aware­AttributeIConcurrency­Controller.​Acquire­Access
Open sandboxFocus

ReadOnlyThreadAwareAttribute.IConcurrencyController.AcquireAccess Method

IConcurrencyController.AcquireAccess(ObjectAccessLevel, ref ConcurrentAccessToken)

Acquires access on the entity for the current thread and waits synchronously if access cannot be immediately acquired.

Declaration
void IConcurrencyController.AcquireAccess(ObjectAccessLevel objectAccessLevel, ref ConcurrentAccessToken concurrencyAccessToken)
Parameters
Type Name Description
ObjectAccessLevel objectAccessLevel

The required access level on the entity.

ConcurrentAccessToken concurrencyAccessToken

An opaque ConcurrentAccessToken, typically used in a using block. Consumers must invoke the Complete() method upon success before exiting the using block.

Implements
IConcurrencyController.AcquireAccess(ObjectAccessLevel, ref ConcurrentAccessToken)
Remarks

When you are using this method through the expression threadAware.ConcurrentController.AcquireAccess, there may be a race condition during the evaluation of the expression. Use the AcquireAccess(IThreadAware, ObjectAccessLevel) extension method to acquire access to a thread-aware object in a thread-safe manner.