diff options
author | mvel <mvel@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:41 +0300 |
commit | 43f5a35593ebc9f6bcea619bb170394ea7ae468e (patch) | |
tree | e98df59de24d2ef7c77baed9f41e4875a2fef972 /util/system/file_lock.cpp | |
parent | bd30392c4cc92487950adc375c07adf52da1d592 (diff) | |
download | ydb-43f5a35593ebc9f6bcea619bb170394ea7ae468e.tar.gz |
Restoring authorship annotation for <mvel@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/file_lock.cpp')
-rw-r--r-- | util/system/file_lock.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/util/system/file_lock.cpp b/util/system/file_lock.cpp index 55160d287f..45d91282c5 100644 --- a/util/system/file_lock.cpp +++ b/util/system/file_lock.cpp @@ -1,8 +1,8 @@ -#include "file_lock.h" +#include "file_lock.h" #include "flock.h" - + #include <util/generic/yexception.h> - + #include <cerrno> namespace { @@ -22,13 +22,13 @@ namespace { TFileLock::TFileLock(const TString& filename, const EFileLockType type) : TFile(filename, OpenAlways | RdOnly) , Type(type) -{ -} - -void TFileLock::Acquire() { +{ +} + +void TFileLock::Acquire() { Flock(GetMode(Type)); -} - +} + bool TFileLock::TryAcquire() { try { Flock(GetMode(Type) | LOCK_NB); @@ -41,6 +41,6 @@ bool TFileLock::TryAcquire() { } } -void TFileLock::Release() { - Flock(LOCK_UN); -} +void TFileLock::Release() { + Flock(LOCK_UN); +} |