Version: SMASH-2.0
filelock.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2020
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_FILELOCK_H_
11 #define SRC_INCLUDE_SMASH_FILELOCK_H_
12 
13 #include <boost/filesystem.hpp>
14 
15 #include "forwarddeclarations.h"
16 
17 namespace smash {
18 
30 class FileLock {
31  public:
39  explicit FileLock(const bf::path& path);
41  ~FileLock();
50  bool acquire();
51 
52  private:
54  bf::path path_;
56  bool acquired_;
57 };
58 
59 } // namespace smash
60 
61 #endif // SRC_INCLUDE_SMASH_FILELOCK_H_
smash
Definition: action.h:24
smash::FileLock::acquired_
bool acquired_
Whether the lock has been acquired.
Definition: filelock.h:56
smash::FileLock::~FileLock
~FileLock()
Delete the lock file when the guard is destroyed.
Definition: filelock.cc:39
smash::FileLock
Guard to create a file lock.
Definition: filelock.h:30
smash::FileLock::path_
bf::path path_
Path to the file lock.
Definition: filelock.h:54
smash::FileLock::FileLock
FileLock(const bf::path &path)
Construct a file lock guard with a lock file at the given path.
Definition: filelock.cc:18
forwarddeclarations.h
smash::FileLock::acquire
bool acquire()
Try to acquire the file lock.
Definition: filelock.cc:20