1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-22 08:51:08 +01:00

Fix path locks move/assignment

No copying allowed

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
This commit is contained in:
John Ericson 2025-12-14 11:49:13 -05:00 committed by Sergei Zimmerman
parent a6eb2e91b7
commit 3a62be7227
No known key found for this signature in database

View file

@ -33,6 +33,22 @@ private:
public:
PathLocks();
PathLocks(const std::set<std::filesystem::path> & paths, const std::string & waitMsg = "");
PathLocks(PathLocks && other) noexcept
: fds(std::exchange(other.fds, {}))
, deletePaths(other.deletePaths)
{
}
PathLocks & operator=(PathLocks && other) noexcept
{
fds = std::exchange(other.fds, {});
deletePaths = other.deletePaths;
return *this;
}
PathLocks(const PathLocks &) = delete;
PathLocks & operator=(const PathLocks &) = delete;
bool lockPaths(const std::set<std::filesystem::path> & _paths, const std::string & waitMsg = "", bool wait = true);
~PathLocks();
void unlock();