1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
10 #include "cmFileLock.h"
12 class cmFileLockResult;
20 cmFileLockPool(cmFileLockPool const&) = delete;
21 cmFileLockPool& operator=(cmFileLockPool const&) = delete;
25 * @brief Function scope control.
27 void PushFunctionScope();
28 void PopFunctionScope();
33 * @brief File scope control.
41 * @brief Lock the file in given scope.
42 * @param timeoutSec Lock timeout. If -1 try until success or fatal error.
44 cmFileLockResult LockFunctionScope(const std::string& filename,
45 unsigned long timeoutSec);
46 cmFileLockResult LockFileScope(const std::string& filename,
47 unsigned long timeoutSec);
48 cmFileLockResult LockProcessScope(const std::string& filename,
49 unsigned long timeoutSec);
53 * @brief Unlock the file explicitly.
55 cmFileLockResult Release(const std::string& filename);
58 bool IsAlreadyLocked(const std::string& filename) const;
66 ScopePool(ScopePool const&) = delete;
67 ScopePool(ScopePool&&) noexcept;
68 ScopePool& operator=(ScopePool const&) = delete;
69 ScopePool& operator=(ScopePool&&) noexcept;
71 cmFileLockResult Lock(const std::string& filename,
72 unsigned long timeoutSec);
73 cmFileLockResult Release(const std::string& filename);
74 bool IsAlreadyLocked(const std::string& filename) const;
77 using List = std::vector<cmFileLock>;
82 using List = std::vector<ScopePool>;
86 ScopePool ProcessScope;