3 #ifndef __ARC_FILELOCK_H__ 4 #define __ARC_FILELOCK_H__ 8 #include <arc/Logger.h> 50 FileLock(
const std::string& filename,
67 bool acquire(
bool& lock_removed);
93 int check(
bool log_error =
true);
100 std::string filename;
102 std::string lock_file;
110 std::string hostname;
115 bool acquire_(
bool& lock_removed);
118 bool write_pid(
int h);
Arc namespace contains all core ARC classes.
Definition: ArcConfig.h:11
static const int DEFAULT_LOCK_TIMEOUT
Default timeout for a lock.
Definition: FileLock.h:39
bool release(bool force=false)
Release the lock.
static const std::string LOCK_SUFFIX
Suffix added to file name to make lock file.
Definition: FileLock.h:41
FileLock(const std::string &filename, unsigned int timeout=DEFAULT_LOCK_TIMEOUT, bool use_pid=true)
Create a new FileLock object.
A logger class.
Definition: Logger.h:493
A general file locking class.
Definition: FileLock.h:36
int check(bool log_error=true)
Check the lock is valid.
bool acquire()
Acquire the lock.
static std::string getLockSuffix()
Get the lock suffix used.