Gets an exclusive lock on a file. More...
#include <LockFile.h>
Public Member Functions | |
LockFile (const std::string &filename, bool do_lock=true) | |
~LockFile () | |
Protected Attributes | |
const bool | _do_lock |
int | _fd |
const std::string | _filename |
Gets an exclusive lock on a file.
This uses RAII to obtain the lock in the constructor and release the lock in the destructor. Additionally, to allow for easier use as a stack variable, an optional bool is allowed to specify that no locking is actually done. This is useful for the case where only certain processors need to obtain the lock.
Definition at line 22 of file LockFile.h.
LockFile::LockFile | ( | const std::string & | filename, |
bool | do_lock = true |
||
) |
Definition at line 16 of file LockFile.C.
LockFile::~LockFile | ( | ) |
Definition at line 32 of file LockFile.C.
|
protected |
Definition at line 29 of file LockFile.h.
Referenced by LockFile(), and ~LockFile().
|
protected |
Definition at line 30 of file LockFile.h.
Referenced by LockFile(), and ~LockFile().
|
protected |
Definition at line 31 of file LockFile.h.
Referenced by ~LockFile().