PostSharp 4.3 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Threading Namespace
PostSharp.Patterns.Threading Namespace
The PostSharp.Patterns.Threading namespace contains an implementation of several threading models, and other thread dispatching aspects.
  Class Description
Public class AccessLevelAttribute
Public class Actor Obsolete.
Public class ActorAttribute
Custom attribute that, when applied to a class, implements the ActorThreadingModel to this class, in which calls to methods are processed asynchronously from a single thread, suppressing concurrency inside each instance of the target class.
Public class ActorDispatcher
A dispatcher compatible with the ActorThreadingModel threading model, with a message queue based on a ConcurrentQueue The queue itself is processed from the ThreadPool.
Public class ActorExceptionEventArgs Obsolete.
Public class AssumeImmutableAttribute
Custom attribute that, when applied to a targetType, means that targetType should be assumed to be immutable. The custom attribute can be applied to a type on assembly level by specifying the Type property using the AssumeImmutableAttribute(Type) constructor.
Public class BackgroundAttribute
Custom attribute that, when applied on a method, causes the method to execute in the background.
Public class ConcurrencyControllerFactory
Provides methods to create new instances of concurrency controllers.
Public class ConcurrentAccessException
Exception thrown when two threads simultaneously attempt to access a method annotated with the ThreadUnsafeAttribute custom attribute.
Public class DeadlockDetectedEventArgs
Arguments for the DeadlockDetected event.
Public class DeadlockDetectionPolicy
Detects deadlocks occurring because of circular wait conditions.
Public class DeadlockedThreadInfo
Described state of thread that was detected to be in a deadlock.
Public class DeadlockException
Exception thrown by the DeadlockDetectionPolicy class when a deadlock is detected.
Public class DeadlockInfo
Describes the detected deadlock.
Public class DispatchedAttribute
Custom attribute that, when applied on a method, specifies that the method should be executed in UI thread.
Public class DispatcherFactory
Provides implementations of the IDispatcher interface.
Public class EntryPointAttribute
Custom attribute that, when applied to a private or protected instance method, causes all threading model aspects (derived from ThreadAwareAttribute to introduce runtime generation code.
Public class ExplicitlySynchronizedAttribute
Custom attribute that, when applied to a method or field, specifies that threading model aspects (derived from ThreadAwareAttribute) should ignore all verifications for this field or method.
Public class FreezableAttribute
Custom attribute that, when applied to a class, implements the FreezableThreadingModel to this class. The aspect introduces the IFreezable interface into the target class. After the Freeze() method has been invoked, the object can no longer be modified, and can therefore be safely shared between several threads.
Public class ImmutableAttribute
Custom attribute that, when applied to a class, implements the ImmutableThreadingModel to this class. The aspect introduces the IImmutable interface into the target class. Immutable objects cannot be modified after the constructor exits.
Public class LockNotHeldException Obsolete.
Public class ObjectReadOnlyException
Exception thrown by objects that have the FreezableThreadingModel or ImmutableThreadingModel when an attempt is made to modify the object after it has been made read-only.
Public class ObserverLockAttribute Obsolete.
Public class PrivateThreadAwareAttribute
Custom attribute that, when applied to a class, implement the PrivateThreadingModel into this class, in which the threading model of an object is determined by the parent it is assigned to in a parent-child relationship.
Public class ReaderAttribute
Custom attribute that, when applied on a method, specifies that the method requires read access to the object.
Public class ReaderLockAttribute Obsolete.
Public class ReaderWriterLockAttribute Obsolete.
Public class ReaderWriterSynchronizedAttribute
Custom attribute that, when applied on a class, applies the ReaderWriterSynchronizedThreadingModel model to this class and all derived class. Members of this class must then be annotated with attributes specifying the required access level (ReaderAttribute, WriterAttribute, YielderAttribute or UpgradeableReaderAttribute), otherwise build-time and run-time errors are emitted.
Public class ReadOnlyThreadAwareAttribute
Base class for aspects FreezableAttribute and ImmutableAttribute.
Public class ReentrantAttribute
Custom attribute that means that the async method to which it is applied can be safely re-entered on each await statement. In case of lock-based models, it means that the lock is released while awaiting. For the actor model, it means that other methods can be invoked during awaiting.
Public class RequiresThreadSafeAttribute
Custom attribute that, when applied to a field, property or parameter, checks that the assigned object is thread safe. Otherwise, the assignment results in an ArgumentException/
Public class SynchronizedAttribute
Custom attribute that, when applied to a class, implements the SynchronizedThreadingModel into this class. In a synchronized object, only a single thread can access the object at a time. If a second thread needs to access the object while it is in used by a first thread, the second thread has to wait until the first thread completes its access.
Public class ThreadAccessException
Exception thrown when the calling thread does not have access to the object.
Public class ThreadAffineAttribute
Custom attribute that, when applied on a type, ensures the instances of this type can only be accessed by the thread that created the instance. When a different thread accesses instances of this type, a ThreadMismatchException exception is thrown.
Public class ThreadAwareAttribute
Base class for all aspects implementing threading models.
Public class ThreadAwareAttributeTargetClass
Describes the members that are consumed by the ThreadAwareAttribute aspect. You can define one or many of these members in classes that are the target of ThreadAwareAttribute to customize the behavior of the ThreadAwareAttribute aspect.
Public class ThreadAwareExtensions
Provides extension methods to the IThreadAware interface.
Public class ThreadingException
Base class for exceptions thrown by the PostSharp.Patterns.Threading component.
Public class ThreadingModel
Base class for all threading models. Defines properties that describe the characteristics of threading models. All classes derived from ThreadingModel are necessarily singletons.
Public class ThreadingPatternsAspectRoles
Enumerates the aspect roles (for use with AspectRoleDependencyAttribute) used by the PostSharp.Patterns.Threading component.
Public class ThreadingServices
Exposes methods to work with the PostSharp.Patterns.Threading namespace.
Public class ThreadingUnhandledExceptionEventArgs
Arguments of the UnhandledException event.
Public class ThreadMismatchException
Exception thrown when a thread attempts to access an object that is affined to another thread.
Public class ThreadSafetyPolicy
When applied to an assembly, this policy will check for possible concurrency issues.
Public class ThreadUnsafeAttribute
Custom attribute that, when applied on a type, ensures that only one thread executes in methods of this type. When more than one thread accesses methods of this type, a ConcurrentAccessException exception is thrown.
Public class UpgradeableReaderAttribute
Custom attribute that, when applied on a method, specifies that the method requires read and write access to the object, but other threads are allowed to acquire read (but not write) access to the object until a method with the WriterAttribute custom attribute is executed.
Public class UpgradeableReaderLockAttribute Obsolete.
Public class WriterAttribute
Custom attribute that, when applied on a method, specifies that the method requires write access to the object.
Public class WriterLockAttribute Obsolete.
Public class YielderAttribute
Custom attribute that, when applied on a method, specifies that the method that currently holds write access to the object (see WriterAttribute) allows other threads to read the object during the execution of the target method. This custom attribute is typically used on methods that raise events that must be processed synchronously by other threads.
  Structure Description
Public structure AmbientConcurrencyControllerContext
A disposable cookie returned by WithConcurrencyController(IConcurrencyController).
Public structure ConcurrentAccessAwaiter
An awaiter for the AcquireAccessAsync(ObjectAccessLevel) method. The struct implements both the Awaiter and Awaitable contracts.
Public structure ConcurrentAccessToken
Token returned by the AcquireAccess(ObjectAccessLevel, ConcurrentAccessToken) method. This token is intended to be used in a using block. Consumers of this method must call Complete() on success, and Dispose() on exception.
  Interface Description
Public interface IActor
Interface implemented by the ActorAttribute aspect.
Public interface IActorController
Specific definition of the IConcurrencyController for the ActorThreadingModel.
Public interface IActorDispatcher
Augments the IDispatcher interface with an Initialize() method, which is invoked after the actor constructor has been invoked.
Public interface IConcurrencyController
Controls access to an entity from possibly several threads.
Public interface IDispatcher
Defines the semantics of a facility that executes actions synchronously or asynchronously, possibly on a different thread.
Public interface IDispatcherObject
Interface implemented by objects that are whose access to methods is being controlled by a Dispatcher.
Public interface IFreezable
Interface implemented by the FreezableAttribute aspect. Defines a Freeze() method.
Public interface IImmutable
Interface implemented by the ImmutableAttribute aspect.
Public interface IThreadAware
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.
  Enumeration Description
Public enumeration ThreadingUnhandledExceptionSource
Enumeration of components that can raise the UnhandledException event.