Belle II Software light-2406-ragdoll
|
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. | |
~Lock () | |
Destructor. | |
bool | lock (int timeout=300, bool ignoreErrors=false) |
Try to lock the file. | |
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 177 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 189 of file FileSystem.cc.
|
private |
File descriptor of file to be locked.
Definition at line 123 of file FileSystem.h.
|
private |
if this is a read-only lock (multiple processes can hold one).
Definition at line 124 of file FileSystem.h.