Click or drag to resize

LongSynchronizedOperation Class

Represents a long-running synchronized operation that cannot run while it is already in progress.
Inheritance Hierarchy
SystemObject
  GSF.ThreadingSynchronizedOperationBase
    GSF.ThreadingLongSynchronizedOperation

Namespace: GSF.Threading
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public class LongSynchronizedOperation : SynchronizedOperationBase
View Source

The LongSynchronizedOperation type exposes the following members.

Constructors
 NameDescription
Public methodLongSynchronizedOperation(Action) Creates a new instance of the LongSynchronizedOperation class.
Public methodLongSynchronizedOperation(Action, ActionException) Creates a new instance of the LongSynchronizedOperation class.
Top
Properties
 NameDescription
Public propertyIsBackground Gets or sets whether or not the thread executing the action is a background thread.
Public propertyIsPending Gets a value to indiate whether the synchronized operation has an additional operation that is pending execution after the currently running action has completed.
(Inherited from SynchronizedOperationBase)
Public propertyIsRunning Gets a value to indicate whether the synchronized operation is currently executing its action.
(Inherited from SynchronizedOperationBase)
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodExecuteAction Executes the action once on the current thread.
(Inherited from SynchronizedOperationBase)
Protected methodExecuteActionAsync Executes the action on a separate thread.
(Overrides SynchronizedOperationBaseExecuteActionAsync)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodRun Executes the action on this thread or marks the operation as pending if the operation is already running.
(Inherited from SynchronizedOperationBase)
Public methodRunOnce Executes the action on this thread or marks the operation as pending if the operation is already running.
(Inherited from SynchronizedOperationBase)
Public methodRunOnceAsync Executes the action on another thread or marks the operation as pending if the operation is already running.
(Inherited from SynchronizedOperationBase)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodTryRun Attempts to execute the action on this thread. Does nothing if the operation is already running.
(Inherited from SynchronizedOperationBase)
Public methodTryRunOnce Attempts to execute the action on this thread. Does nothing if the operation is already running.
(Inherited from SynchronizedOperationBase)
Public methodTryRunOnceAsync Attempts to execute the action on another thread. Does nothing if the operation is already running.
(Inherited from SynchronizedOperationBase)
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks
The action performed by the LongSynchronizedOperation is executed on its own dedicated thread when running the operation asynchronously. When running on its own thread, the action is executed in a tight loop until all pending operations have been completed. This type of synchronized operation should be preferred if operations may take a long time, block the thread, or put it to sleep. It is also recommended to prefer this type of operation if the speed of the operation is not critical or if completion of the operation is critical, such as when saving data to a file.
See Also