WorkerThreadSynchronization Class

Creates a synchronization helper that will assist object synchronizing in a tight inner loop.

Definition

Namespace: SnapDB.Threading
Assembly: SnapDB (in SnapDB.dll) Version: 1.0.102.0 -- Release Build+29075351d0e5aa4dea46a5c520805222f672dc2e
public class WorkerThreadSynchronization : DisposableLoggingClassBase
Inheritance
Object    DisposableLoggingClassBase    WorkerThreadSynchronization

Remarks

For streaming protocols, it is cost prohibited to tightly coordinate the inner loop. This class will help coordinate these efforts by signaling when a good time to perform synchronized work would be. For Example, when writing to a socket, calling BeginSafeToCallbackRegion would be good to do when the socket makes any kind of blocking call, such as flusing to an underlying socket. Upon returning from this command, calling EndSafeToCallbackRegion will return this class to a state where callback will not be executed. It is critical that BeginSafeToCallbackRegion, EndSafeToCallbackRegion, and PulseSafeToCallback only be called by the worker thread, as these methods are not thread safe and control the state of the WorkerThreadSynchronization. In easy terms. When you (the worker) get a convenient time, I need to do something that might modify your current working state. Let me know when I can do that.

Constructors

WorkerThreadSynchronization Creates a WorkerThreadSynchronization.

Properties

Log The LogPublisher for logging messages.
(Inherited from DisposableLoggingClassBase)

Methods

BeginSafeToCallbackRegion Enters a region where a callback can occur.
CheckDisposed Checks if the class has been disposed, throws an exception if this is the case.
(Inherited from DisposableLoggingClassBase)
Dispose Releases all the resources used by the DisposableLoggingClassBase object.
(Inherited from DisposableLoggingClassBase)
Dispose(Boolean) Releases the unmanaged resources used by the DisposableLoggingClassBase object and optionally releases the managed resources.
(Inherited from DisposableLoggingClassBase)
EndSafeToCallbackRegion Exits a region where future callbacks cannot occur.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize This code is here to detect when finalizers are called rather than a class be properly disposed.
(Inherited from DisposableLoggingClassBase)
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)
PulseSafeToCallback Signals that if any callbacks are pending, go ahead and run them now. Otherwise, wait.
RequestCallback Requests that the following action be completed as soon as reasonably possible. This will either be done immediately, or be queued for the next approriate time.
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also