Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | bool LockDirectory(const fs::path &directory, const std::string lockfile_name, | ||||
} | } | ||||
if (!probe_only) { | if (!probe_only) { | ||||
// Lock successful and we're not just probing, put it into the map | // Lock successful and we're not just probing, put it into the map | ||||
dir_locks.emplace(pathLockFile.string(), std::move(lock)); | dir_locks.emplace(pathLockFile.string(), std::move(lock)); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
void UnlockDirectory(const fs::path &directory, | |||||
const std::string &lockfile_name) { | |||||
std::lock_guard<std::mutex> lock(cs_dir_locks); | |||||
dir_locks.erase((directory / lockfile_name).string()); | |||||
} | |||||
void ReleaseDirectoryLocks() { | void ReleaseDirectoryLocks() { | ||||
std::lock_guard<std::mutex> ulock(cs_dir_locks); | std::lock_guard<std::mutex> ulock(cs_dir_locks); | ||||
dir_locks.clear(); | dir_locks.clear(); | ||||
} | } | ||||
bool DirIsWritable(const fs::path &directory) { | bool DirIsWritable(const fs::path &directory) { | ||||
fs::path tmpFile = directory / fs::unique_path(); | fs::path tmpFile = directory / fs::unique_path(); | ||||
▲ Show 20 Lines • Show All 1,245 Lines • Show Last 20 Lines |