2006-09-05 00:06:23 +03:00
|
|
|
#include "pathlocks.hh"
|
|
|
|
#include "util.hh"
|
2016-12-09 14:26:43 +02:00
|
|
|
#include "sync.hh"
|
2023-10-25 07:43:36 +03:00
|
|
|
#include "signals.hh"
|
2006-09-05 00:06:23 +03:00
|
|
|
|
2003-09-11 11:31:29 +03:00
|
|
|
#include <cerrno>
|
2008-05-21 14:17:31 +03:00
|
|
|
#include <cstdlib>
|
2003-09-11 11:31:29 +03:00
|
|
|
|
2003-08-01 17:11:19 +03:00
|
|
|
|
2006-09-05 00:06:23 +03:00
|
|
|
namespace nix {
|
|
|
|
|
2004-05-11 21:05:44 +03:00
|
|
|
PathLocks::PathLocks()
|
2003-11-21 18:05:19 +02:00
|
|
|
: deletePaths(false)
|
2003-08-01 17:11:19 +03:00
|
|
|
{
|
2004-05-11 21:05:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-25 17:00:00 +02:00
|
|
|
PathLocks::PathLocks(const PathSet & paths, const std::string & waitMsg)
|
2004-05-11 21:05:44 +03:00
|
|
|
: deletePaths(false)
|
|
|
|
{
|
2006-06-15 14:56:49 +03:00
|
|
|
lockPaths(paths, waitMsg);
|
2004-05-11 21:05:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-01 17:11:19 +03:00
|
|
|
PathLocks::~PathLocks()
|
2009-02-16 11:24:20 +02:00
|
|
|
{
|
2016-01-04 12:32:46 +02:00
|
|
|
try {
|
|
|
|
unlock();
|
|
|
|
} catch (...) {
|
|
|
|
ignoreException();
|
|
|
|
}
|
2009-02-16 11:24:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-21 18:05:19 +02:00
|
|
|
void PathLocks::setDeletion(bool deletePaths)
|
|
|
|
{
|
|
|
|
this->deletePaths = deletePaths;
|
2003-08-01 17:11:19 +03:00
|
|
|
}
|
2006-09-05 00:06:23 +03:00
|
|
|
|
2007-08-28 14:36:17 +03:00
|
|
|
|
2006-09-05 00:06:23 +03:00
|
|
|
}
|