LogicalThreadOperation Class

Synchronized operation that executes on a logical thread.

Definition

Namespace: Gemstone.Threading.LogicalThreads
Assembly: Gemstone.Threading (in Gemstone.Threading.dll) Version: 1.0.171 -- Release Build+1fadf9883481af612a0ac41fa386e4d8235ed765
public class LogicalThreadOperation
Inheritance
Object    LogicalThreadOperation

Remarks

This synchronized operation optionally supports a different usage pattern which will allow for asynchronous loops and signals to be passed between threads throughout an operation. The following is an example of how to implement a simple asynchronous loop between two threads using this class. Note that when used, the pattern requires more diligence on the user's part for handling exceptions and signaling when the operation is complete: LogicalThread thread1 = new LogicalThread(); LogicalThread thread2 = new LogicalThread(); // Create logical thread operation with manually controlled call to RunIfPending LogicalThreadOperation operation = new LogicalThreadOperation(thread1, DoOperation, false); private void DoOperation() { ExecuteOnThread1(); thread2.Push(() => operation.ExecuteAction(() => { ExecuteOnThread2(); operation.RunIfPending(); })); });

Constructors

LogicalThreadOperation(LogicalThread, Action, Boolean) Creates a new instance of the LogicalThreadOperation class.
LogicalThreadOperation(LogicalThread, Action, Int32, Boolean) Creates a new instance of the LogicalThreadOperation class.

Properties

AutoRunIfPending Gets flag that determines if RunIfPending will be called automatically.
IsPending Gets a value to indicate whether the operation has an additional operation that is pending execution after the currently running operation has completed.
IsRunning Gets a value to indicate whether the operation is currently executing actions.
Priority Gets or sets default priority for logical thread operation.

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
ExecuteAction Executes an action once on the current thread.
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)
RequeueAction If the operation is running, the action has yet to be executed, and the given priority level differs from the queued action's priority level, this method will requeue the action at the given priority level.
RunIfPending Starts the operation over at the beginning if the operation is pending or sets the operation state back to not running so it can run again.
RunOnce Executes the action on the current thread or marks the operation as pending if the operation is already running.
RunOnceAsync Executes the action on another thread or marks the operation as pending if the operation is already running.
ToStringReturns a string that represents the current object.
(Inherited from Object)
TryRunOnce Attempts to execute the action on the current thread. Does nothing if the operation is already running.
TryRunOnceAsync Attempts to execute the action on another thread. Does nothing if the operation is already running.

See Also