Provides a framework for blocking execution until the specified condition becomes satisfied. Function Wait() does that. The function continuously check the unblocking condition until it becomes satisfied, sleeping a certain amount of time between consecutive checks. Time plan of checks (i.e. the amount of sleepin time between them) can be adjusted by public properties SleepFirst, MinSleepMs, MaxSleepMs, and MaxRelativeLatency. These properties can be adjusted while waiting. Blocking condition is evaluated by the (public) function Condition() and can be adjusted in one of the following ways:
More...
|
| WaitCondition () |
| Creates event waiter with properties initialized to default values. More...
|
|
| WaitCondition (int minSleepMs, double maxRelativeLatency) |
| Creates event waiter with properties initialized to specified values (or to default valuse for those parameters that are not specified). More...
|
|
| WaitCondition (int minSleepMs, int maxSleepMs, double maxRelativeLatency, bool sleepFirst) |
| Creates event waiter with properties initialized to specified values (or to default valuse for those parameters that are not specified). More...
|
|
override bool | Condition () |
| Function that returns true if unblocking condition is satisfied, and false otherwise. If the condition delegate is set then the delegate is used to evaluate the condition, otherwise the protected method ConditionFunction() is used. The condition can therefore be adjusted in one of the following ways: More...
|
|
override void | Wait () |
| Blocks until the specified condition gets satisfied. See class description for details. More...
|
|
override string | ToString () |
|
virtual void | CancelOne () |
| Cancels the current waiting for the condition (if one is going on) and unblocks the thread on which waiting was called (possibly with some latency). More...
|
|
virtual void | CancelAll () |
| Cancel the current waiting for the condition on all threads. More...
|
|
|
virtual void | InitWaitCondition () |
| Initializes object properties with default values. More...
|
|
virtual void | InitWaitCondition (int minSleepMs, double maxRelativeLatency) |
| Initializes blocking parameters to the specified values (or to default values for those parameters that are not specified). More...
|
|
virtual void | InitWaitCondition (int minSleepMs, int maxSleepMs, double maxRelativeLatency, bool sleepFirst) |
| Initializes blocking parameters. More...
|
|
virtual bool | ConditionFunction () |
| Evaluates blocking condition in the case that the condition delegate is not specified. More...
|
|
|
virtual ConditionDelegateBase | ConditionDelegate [protected get, set] |
| Contains function that is called to evaluate the unblocking condition. If this delegate is set and Condition() is not overridden then the delegate is used to check whether the unblocking condition is satisfied. More...
|
|
virtual int | MinSleepMs [get, set] |
| Minimal sleeping time, in milliseconds, between successive condition checks. If less than 0 then minimal sleeping time is not specified, so there may be no sleeping. More...
|
|
virtual int | MaxSleepMs [get, set] |
| Maximal sleeping time, in milliseconds, between successive condition checks. If less than 0 then maximal sleeping time is not specified and sleeping interval is not bounded above. If set to 0 then no sleeping will be performed between successive checks (max. sleeping time overrides the minimal sleeping time). More...
|
|
virtual double | MaxRelativeLatency [get, set] |
| Maximal relative latency of waiting procedure. Sleeping time chosen between two successive condition check willl be chosen smaller or equal to total elapsed waiting time multiplied by this number. If less than 0 then maximal relative latency is not specified. If minimal sleeping time is specified then it overrides the sleeping time calculated according to this parameter. More...
|
|
virtual bool | SleepFirst [get, set] |
| If true and if minimal sleeping time is larger than 0, then sleep for minimal sleeping time will be performed before the first check for unblocking condition. More...
|
|
StopWatch1 | Timer [get] |
| Timer that measures the total time elapsed when waiting for fulfillment of unblocking condition. Used to evaluate appropriate sleeping times that will not cause too much latency. More...
|
|
object | Lock [get] |
| This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More...
|
|
object | InternalLock [get] |
| Used internally for locking access to internal fields. More...
|
|
object | WaitLock [get] |
| Must be used only for locking waiting the Waiting() block (since it is potentially time consuming). More...
|
|
virtual bool | IsWaiting [get, protected set] |
| True if waiting for unblocking condition is currently performed, and false otherwise. Setting should only be done within the waiting function. More...
|
|
virtual bool | CancelFlag [get, set] |
| If this flag is set then the current waiting (if one is going on) will be cancelled. More...
|
|
bool | IsWaiting [get] |
| Returns true if waiting for unblocking condition is currently performed, and false otherwise. Setting should only be done within the waiting function. More...
|
|
object | Lock [get] |
|
Provides a framework for blocking execution until the specified condition becomes satisfied. Function Wait() does that. The function continuously check the unblocking condition until it becomes satisfied, sleeping a certain amount of time between consecutive checks. Time plan of checks (i.e. the amount of sleepin time between them) can be adjusted by public properties SleepFirst, MinSleepMs, MaxSleepMs, and MaxRelativeLatency. These properties can be adjusted while waiting. Blocking condition is evaluated by the (public) function Condition() and can be adjusted in one of the following ways:
- by setting the delegate ConditionDelegate.
- by overriding the protected ConditionFunction() in a derived class and setting ConditionDelegate to null.
- by overriding the Condition() function itself.
$A Igor Jun10;
IG.Lib.WaitCondition.WaitCondition |
( |
| ) |
|
|
inline |
Creates event waiter with properties initialized to default values.
IG.Lib.WaitCondition.WaitCondition |
( |
int |
minSleepMs, |
|
|
double |
maxRelativeLatency |
|
) |
| |
|
inline |
Creates event waiter with properties initialized to specified values (or to default valuse for those parameters that are not specified).
IG.Lib.WaitCondition.WaitCondition |
( |
int |
minSleepMs, |
|
|
int |
maxSleepMs, |
|
|
double |
maxRelativeLatency, |
|
|
bool |
sleepFirst |
|
) |
| |
|
inline |
Creates event waiter with properties initialized to specified values (or to default valuse for those parameters that are not specified).
virtual void IG.Lib.WaitCondition.InitWaitCondition |
( |
| ) |
|
|
inlineprotectedvirtual |
Initializes object properties with default values.
virtual void IG.Lib.WaitCondition.InitWaitCondition |
( |
int |
minSleepMs, |
|
|
double |
maxRelativeLatency |
|
) |
| |
|
inlineprotectedvirtual |
Initializes blocking parameters to the specified values (or to default values for those parameters that are not specified).
virtual void IG.Lib.WaitCondition.InitWaitCondition |
( |
int |
minSleepMs, |
|
|
int |
maxSleepMs, |
|
|
double |
maxRelativeLatency, |
|
|
bool |
sleepFirst |
|
) |
| |
|
inlineprotectedvirtual |
Initializes blocking parameters.
override bool IG.Lib.WaitCondition.Condition |
( |
| ) |
|
|
inline |
Function that returns true if unblocking condition is satisfied, and false otherwise. If the condition delegate is set then the delegate is used to evaluate the condition, otherwise the protected method ConditionFunction() is used. The condition can therefore be adjusted in one of the following ways:
- by setting the ConditionDelegate field
- by overriding the ConditionFunction and leaving ConditionDelegate null.
Implements IG.Lib.IWaitCondition.
virtual bool IG.Lib.WaitCondition.ConditionFunction |
( |
| ) |
|
|
inlineprotectedvirtual |
Evaluates blocking condition in the case that the condition delegate is not specified.
- Returns
- True if the unblocking condition is satisfied (such that the thread will continue with execution) after the condition is being evaluated.
Reimplemented in IG.Lib.WaitFileEventLatenceBase.
override void IG.Lib.WaitCondition.Wait |
( |
| ) |
|
|
inline |
Blocks until the specified condition gets satisfied. See class description for details.
This method will normally not be overridden, except with intention to change the condition check time plan. When overriding, use the original method as template.
Implements IG.Lib.IWaitCondition.
Referenced by IG.Lib.WaitFileEventBaseByProxyLatence.Wait().
override string IG.Lib.WaitCondition.ToString |
( |
| ) |
|
|
inline |
int IG.Lib.WaitCondition._minSleepMs = 1 |
|
protected |
int IG.Lib.WaitCondition._maxSleepMs = -1 |
|
private |
double IG.Lib.WaitCondition._maxRelativeLatency = 0.05 |
|
private |
bool IG.Lib.WaitCondition._sleepFirst = false |
|
private |
Contains function that is called to evaluate the unblocking condition. If this delegate is set and Condition() is not overridden then the delegate is used to check whether the unblocking condition is satisfied.
virtual int IG.Lib.WaitCondition.MinSleepMs |
|
getset |
Minimal sleeping time, in milliseconds, between successive condition checks. If less than 0 then minimal sleeping time is not specified, so there may be no sleeping.
virtual int IG.Lib.WaitCondition.MaxSleepMs |
|
getset |
Maximal sleeping time, in milliseconds, between successive condition checks. If less than 0 then maximal sleeping time is not specified and sleeping interval is not bounded above. If set to 0 then no sleeping will be performed between successive checks (max. sleeping time overrides the minimal sleeping time).
virtual double IG.Lib.WaitCondition.MaxRelativeLatency |
|
getset |
Maximal relative latency of waiting procedure. Sleeping time chosen between two successive condition check willl be chosen smaller or equal to total elapsed waiting time multiplied by this number. If less than 0 then maximal relative latency is not specified. If minimal sleeping time is specified then it overrides the sleeping time calculated according to this parameter.
virtual bool IG.Lib.WaitCondition.SleepFirst |
|
getset |
If true and if minimal sleeping time is larger than 0, then sleep for minimal sleeping time will be performed before the first check for unblocking condition.
Timer that measures the total time elapsed when waiting for fulfillment of unblocking condition. Used to evaluate appropriate sleeping times that will not cause too much latency.
The documentation for this class was generated from the following file: