hecl/hecl: Assign ResourceLock's good member in the initializer list

Same behavior, but more idiomatic. While we're at it, we can make said
constructor and the conversion operator explicit to make the class a
little less error-prone.
This commit is contained in:
Lioncash 2019-08-15 02:10:49 -04:00
parent 92b87676c2
commit eb872cdf88
1 changed files with 2 additions and 2 deletions

View File

@ -1110,9 +1110,9 @@ class ResourceLock {
bool good;
public:
operator bool() const { return good; }
explicit operator bool() const { return good; }
static bool InProgress(const ProjectPath& path);
ResourceLock(const ProjectPath& path) { good = SetThreadRes(path); }
explicit ResourceLock(const ProjectPath& path) : good{SetThreadRes(path)} {}
~ResourceLock() {
if (good)
ClearThreadRes();