Belle II Software
release-08-01-10
|
Helper class for locking a file. More...
#include <FileSystem.h>
Public Member Functions | |
Lock (const std::string &fileName, bool readonly=false) | |
Construct a Lock object for the given file. More... | |
~Lock () | |
Destructor. More... | |
bool | lock (int timeout=300, bool ignoreErrors=false) |
Try to lock the file. More... | |
Private Attributes | |
int | m_file |
File descriptor of file to be locked. | |
bool | m_readOnly |
if this is a read-only lock (multiple processes can hold one). | |
Helper class for locking a file.
Definition at line 97 of file FileSystem.h.
|
explicit |
Construct a Lock object for the given file.
fileName | Name of the file to be locked (if it does not exist, it will be created) |
readonly | create a read-only lock (multiple processes can hold one) |
Definition at line 174 of file FileSystem.cc.
~Lock | ( | ) |
bool lock | ( | int | timeout = 300 , |
bool | ignoreErrors = false |
||
) |
Try to lock the file.
timeout | Time in seconds to wait for a lock (default is rather high to deal with slow FS at KEKCC) |
ignoreErrors | if true just return if locking was unsuccessful but don't print an error |
Definition at line 186 of file FileSystem.cc.