diff options
Diffstat (limited to 'Source/cmFileLock.cxx')
-rw-r--r-- | Source/cmFileLock.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx index e90f571..6010233 100644 --- a/Source/cmFileLock.cxx +++ b/Source/cmFileLock.cxx @@ -3,11 +3,23 @@ #include "cmFileLock.h" #include <cassert> +#include <utility> #include "cmFileLockResult.h" // Common implementation +cmFileLock::cmFileLock(cmFileLock&& other) noexcept +{ + this->File = other.File; +#if defined(_WIN32) + other.File = INVALID_HANDLE_VALUE; +#else + other.File = -1; +#endif + this->Filename = std::move(other.Filename); +} + cmFileLock::~cmFileLock() { if (!this->Filename.empty()) { @@ -17,6 +29,19 @@ cmFileLock::~cmFileLock() } } +cmFileLock& cmFileLock::operator=(cmFileLock&& other) noexcept +{ + this->File = other.File; +#if defined(_WIN32) + other.File = INVALID_HANDLE_VALUE; +#else + other.File = -1; +#endif + this->Filename = std::move(other.Filename); + + return *this; +} + cmFileLockResult cmFileLock::Lock(const std::string& filename, unsigned long timeout) { |