diff options
Diffstat (limited to 'Source/cmFileLock.cxx')
-rw-r--r-- | Source/cmFileLock.cxx | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx index 0d41c53..828511f 100644 --- a/Source/cmFileLock.cxx +++ b/Source/cmFileLock.cxx @@ -19,49 +19,41 @@ cmFileLock::~cmFileLock() { - if (!this->Filename.empty()) - { + if (!this->Filename.empty()) { const cmFileLockResult result = this->Release(); static_cast<void>(result); assert(result.IsOk()); - } + } } -cmFileLockResult cmFileLock::Lock( - const std::string& filename, unsigned long timeout) +cmFileLockResult cmFileLock::Lock(const std::string& filename, + unsigned long timeout) { - if (filename.empty()) - { + if (filename.empty()) { // Error is internal since all the directories and file must be created // before actual lock called. return cmFileLockResult::MakeInternal(); - } + } - if (!this->Filename.empty()) - { + if (!this->Filename.empty()) { // Error is internal since double-lock must be checked in class // cmFileLockPool by the cmFileLock::IsLocked method. return cmFileLockResult::MakeInternal(); - } + } this->Filename = filename; cmFileLockResult result = this->OpenFile(); - if (result.IsOk()) - { - if (timeout == static_cast<unsigned long>(-1)) - { + if (result.IsOk()) { + if (timeout == static_cast<unsigned long>(-1)) { result = this->LockWithoutTimeout(); - } - else - { + } else { result = this->LockWithTimeout(timeout); - } } + } - if (!result.IsOk()) - { + if (!result.IsOk()) { this->Filename = ""; - } + } return result; } @@ -72,7 +64,7 @@ bool cmFileLock::IsLocked(const std::string& filename) const } #if defined(_WIN32) -# include "cmFileLockWin32.cxx" +#include "cmFileLockWin32.cxx" #else -# include "cmFileLockUnix.cxx" +#include "cmFileLockUnix.cxx" #endif |