mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
cmFileLockPool: enhance items management
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user