summaryrefslogtreecommitdiffstats
path: root/Source/cmFileLock.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2019-11-12 16:17:27 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2019-11-14 13:21:30 (GMT)
commit8dd284bf196de65caec90eff8723b59559434149 (patch)
treeb481e6e24ee623c1cd06306c42df08e60f66cedb /Source/cmFileLock.cxx
parentaeb95264e02252aba705166dfb8410baff0e715d (diff)
downloadCMake-8dd284bf196de65caec90eff8723b59559434149.zip
CMake-8dd284bf196de65caec90eff8723b59559434149.tar.gz
CMake-8dd284bf196de65caec90eff8723b59559434149.tar.bz2
cmFileLockPool: enhance items management
Diffstat (limited to 'Source/cmFileLock.cxx')
-rw-r--r--Source/cmFileLock.cxx25
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)
{