LogicalThread Class

Represents a thread of execution to which actions can be dispatched from other threads.

Definition

Namespace: Gemstone.Threading.LogicalThreads
Assembly: Gemstone.Threading (in Gemstone.Threading.dll) Version: 1.0.167 -- Release Build+6c665d9111cb5e0fc32e9aa6c693dcb89c216eb7
public class LogicalThread
Inheritance
Object    LogicalThread

Remarks

This class provides a simple alternative to synchronization primitives such as wait handles and locks. Actions dispatched to a logical thread will be processed synchronously as though it was executed as consecutive method calls. All such actions can be dispatched from any thread in the system so method calls coming from multiple threads can be easily synchronized without locks, loops, wait handles, or timeouts.

Note that the LogicalThreadScheduler implements its own thread pool to execute tasks pushed to logical threads. Executing long-running processes or using synchronization primitives with high contention or long timeouts can hinder the logical thread schedulers ability to schedule the actions of other logical threads. Like other thread pool implementations, you can mitigate this by increasing the maximum thread count of the logical thread scheduler, however it is recommended to avoid using synchronization primitives and instead synchronize those operations by running them as separate actions on the same logical thread.

Constructors

LogicalThread Creates a new instance of the LogicalThread class.

Properties

CurrentThread Gets the logical thread that is currently executing.
HasAction Gets a flag that indicates whether the logical thread has any unprocessed actions left in its queue.
PriorityLevels Gets the number of levels of priority supported by this logical thread.

Methods

Clear Clears all actions from the logical thread.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Push(Action) Pushes an action to the logical thread.
Push(Int32, Action) Pushes an action to the logical thread.
SampleStatistics Samples the statistics, providing current statistic values and resetting statistic counters.
ToStringReturns a string that represents the current object.
(Inherited from Object)

Events

UnhandledException Handler for unhandled exceptions on the thread.

See Also