hecl/hecl: Collapse InProgress() into std::any_of()

Same thing, more straightforward.
This commit is contained in:
Lioncash 2019-08-24 15:32:15 -04:00
parent e96eb4cac6
commit 32fec587b5
1 changed files with 2 additions and 4 deletions

View File

@ -129,10 +129,8 @@ static std::unordered_map<std::thread::id, ProjectPath> PathsInProgress;
bool ResourceLock::InProgress(const ProjectPath& path) { bool ResourceLock::InProgress(const ProjectPath& path) {
std::unique_lock lk{PathsMutex}; std::unique_lock lk{PathsMutex};
for (const auto& p : PathsInProgress) return std::any_of(PathsInProgress.cbegin(), PathsInProgress.cend(),
if (p.second == path) [&path](const auto& entry) { return entry.second == path; });
return true;
return false;
} }
bool ResourceLock::SetThreadRes(const ProjectPath& path) { bool ResourceLock::SetThreadRes(const ProjectPath& path) {