IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.WaitFileCreationLatence Class Reference

Implements blocking until the specified file is created (becomes existent). File is specified in constructor or by setting the FilePath property. Waiting is performed by calling the Wait() function. It is implemented by successively checking whether unblocking condition is fulfilled and by sleeping between checks. Therefore it has some latency (i.e. unblocking is not always performed immediatley the condition is met) and spends some CPU time and system resources. More...

+ Inheritance diagram for IG.Lib.WaitFileCreationLatence:
+ Collaboration diagram for IG.Lib.WaitFileCreationLatence:

Public Member Functions

 WaitFileCreationLatence (string filePath)
 
override bool Condition ()
 Returns true if the monitored file exists, and false if not. More...
 
- Public Member Functions inherited from IG.Lib.WaitFileEventLatenceBase
override bool Condition ()
 This method should be overridden in derived classes. More...
 
- Public Member Functions inherited from IG.Lib.WaitCondition
 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 ()
 
- Public Member Functions inherited from IG.Lib.WaitConditionBase
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from IG.Lib.WaitFileEventLatenceBase
static void ExampleBlockCreateRemoveLatence (string filePath)
 Monitors the specified file and successively blocks until it is created and then until it is removed. This procedure is repeated twice. More...
 
static void ExampleBlockCreateRemoveLatence (string filePath, int numSwitches)
 Monitors the specified file and successively blocks until it is created and then until it is removed. More...
 
static void ExampleBlockCreateRemoveLatence (string filePath, int numSwitches, bool waitDirectory)
 Monitors the specified file and successively blocks until it is created and then until it is removed. More...
 
static void TestSpeedBlockCreateRemoveLatence (string filePath)
 Test of speed of reaction of file/directory creation and removal blocking waits. A specified number of alternate creations and removals are perfomed in a parallel thread, with specified delay between them. In the main thread, blocking waits are performed waiting for creation/removal in an infinite loop, and it is counted how many events are captured and how many are missed. More...
 
static void TestSpeedBlockCreateRemoveLatence (string filePath, int numSwitches, int sleepMs)
 Test of speed of reaction of file/directory creation and removal blocking waits. A specified number of alternate creations and removals are perfomed in a parallel thread, with specified delay between them. In the main thread, blocking waits are performed waiting for creation/removal in an infinite loop, and it is counted how many events are captured and how many are missed. More...
 
static void TestSpeedBlockCreateRemoveLatence (string filePath, int numSwitches, int sleepMs, bool waitDirectory)
 Test of speed of reaction of file/directory creation and removal blocking waits. A specified number of alternate creations and removals are perfomed in a parallel thread, with specified delay between them. In the main thread, blocking waits are performed waiting for creation/removal in an infinite loop, and it is counted how many events are captured and how many are missed. More...
 
- Protected Member Functions inherited from IG.Lib.WaitFileEventLatenceBase
 WaitFileEventLatenceBase (string fileOrdirectoryPath)
 
sealed override bool ConditionFunction ()
 Must not be used! More...
 
- Protected Member Functions inherited from IG.Lib.WaitCondition
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...
 
- Protected Attributes inherited from IG.Lib.WaitFileEventLatenceBase
string _fileOrDirectoryPath
 File or directory name. More...
 
- Protected Attributes inherited from IG.Lib.WaitCondition
ConditionDelegateBase _conditionDelegate = null
 
int _minSleepMs = 1
 
StopWatch1 _timer = null
 
- Properties inherited from IG.Lib.WaitFileEventLatenceBase
string Path [get, set]
 Get or set path of the file on which the particular event is waited for. More...
 
sealed override
ConditionDelegateBase 
ConditionDelegate [protected get, set]
 Setter of this property must not be used! More...
 
- Properties inherited from IG.Lib.WaitCondition
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...
 
- Properties inherited from IG.Lib.WaitConditionBase
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...
 
- Properties inherited from IG.Lib.IWaitCondition
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...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 
- Properties inherited from IG.Lib.IWaitFileEvent
string Path [get, set]
 Path of the file or directory on which the particular event is waited for. Can be specified as relative path, but is internally stored as fully qualified path. More...
 

Detailed Description

Implements blocking until the specified file is created (becomes existent). File is specified in constructor or by setting the FilePath property. Waiting is performed by calling the Wait() function. It is implemented by successively checking whether unblocking condition is fulfilled and by sleeping between checks. Therefore it has some latency (i.e. unblocking is not always performed immediatley the condition is met) and spends some CPU time and system resources.

$A Igor Jun10;

Constructor & Destructor Documentation

IG.Lib.WaitFileCreationLatence.WaitFileCreationLatence ( string  filePath)
inline

Member Function Documentation

override bool IG.Lib.WaitFileCreationLatence.Condition ( )
inline

Returns true if the monitored file exists, and false if not.

Implements IG.Lib.IWaitCondition.


The documentation for this class was generated from the following file: