PostSharp 2023.0 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Threading Namespace / IThread­Aware Interface

IThreadAware Interface

Interface implemented by objects that are aware of concurrency. Access to thread-aware objects is controlled by a concurrency controller (IConcurrencyController). Any aspect implementing a threading model (ThreadAwareObjectAttribute) introduces this interface to the target class and ensures that accesses to this class go through the controller.

Namespace:  PostSharp.Patterns.Threading
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 2023.0.3.0 (2023.0.3.0)
public interface IThreadAware

The IThreadAware type exposes the following members.

Public propertyConcurrencyController
Gets the concurrency controller for the current object.
Public methodOnParentControllerChanged
Notifies the object that the effective controller of it's parent has changed.
Extension Methods
Public Extension MethodAcquireAccess(ObjectAccessLevel)Overloaded.
Acquires access to given object and returns the ConcurrentAccessToken.
(Defined by ThreadAwareExtensions.)
Public Extension MethodAcquireAccess(ObjectAccessLevel, ConcurrentAccessToken)Overloaded.
Acquires access for a given object and gets the ConcurrentAccessToken as a reference parameter.
(Defined by ThreadAwareExtensions.)
Public Extension MethodAcquireAccessAsync
Asynchronously acquires access for a given object.
(Defined by ThreadAwareExtensions.)

Thread-aware does not thread-safe. Check the IsSharable property of ConcurrencyController to check if the current object can be shared between different threads.

See Also