Version: SMASH-1.5
filelock.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2018
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_FILELOCK_H_
11 #define SRC_INCLUDE_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_FILELOCK_H_
bool acquire()
Try to acquire the file lock.
Definition: filelock.cc:20
~FileLock()
Delete the lock file when the guard is destroyed.
Definition: filelock.cc:39
bool acquired_
Whether the lock has been acquired.
Definition: filelock.h:56
bf::path path_
Path to the file lock.
Definition: filelock.h:54
Guard to create a file lock.
Definition: filelock.h:30
FileLock(const bf::path &path)
Construct a file lock guard with a lock file at the given path.
Definition: filelock.cc:18
Definition: action.h:24