Passenger::FileChecker Class Reference

Utility class for checking for file changes. More...

#include <FileChecker.h>

List of all members.

Public Member Functions

 FileChecker (const string &filename)
 Create a FileChecker object.
bool changed (unsigned int throttleRate=0)
 Checks whether the file's timestamp has changed or has been created or removed since the last call to changed().


Detailed Description

Utility class for checking for file changes.

Example:

 FileChecker checker("foo.txt");
 checker.changed();   // false
 writeToFile("foo.txt");
 checker.changed();   // true
 checker.changed();   // false

FileChecker uses stat() to retrieve file information. FileChecker also supports throttling in order to limit the number of stat() calls. This can improve performance on systems where disk I/O is a problem.


Constructor & Destructor Documentation

Passenger::FileChecker::FileChecker ( const string &  filename  )  [inline]

Create a FileChecker object.

Parameters:
filename The filename to check for.


Member Function Documentation

bool Passenger::FileChecker::changed ( unsigned int  throttleRate = 0  )  [inline]

Checks whether the file's timestamp has changed or has been created or removed since the last call to changed().

Parameters:
throttleRate When set to a non-zero value, throttling will be enabled. stat() will be called at most once per throttleRate seconds.
Exceptions:
SystemException Something went wrong while retrieving the system time. stat() errors will not result in SystemException being thrown.
boost::thread_interrupted 


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

Generated on Wed Apr 8 22:35:12 2009 for Passenger by  doxygen 1.5.8