00001
00015 #ifndef _DLRUTILITIES_LOCKFILE_H_
00016 #define _DLRUTILITIES_LOCKFILE_H_
00017
00018 #include <string>
00019
00020 namespace dlr {
00021
00022 namespace utilities {
00023
00067 class LockFile {
00068 public:
00069
00086 LockFile(const std::string& fileName,
00087 double timeout = 0.0);
00088
00089
00113 LockFile(const std::string& fileName, const std::string& contents,
00114 double timeout = 0.0);
00115
00116
00121 ~LockFile();
00122
00123
00133 bool
00134 isValid();
00135
00136
00151 bool
00152 retry(double timeout = 0.0);
00153
00154 private:
00155
00156 int m_fileDescriptor;
00157 std::string m_fileName;
00158
00159 };
00160
00161 }
00162
00163 }
00164
00165
00166
00167
00168 namespace dlr {
00169
00170 using utilities::LockFile;
00171
00172 }
00173
00174 #endif // #ifndef _DLRUTILITES_LOCKFILE_H_