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 | bd30392c4cc92487950adc375c07adf52da1d592 (patch) | |
tree | e8d1a3f19b7fc890bcef6e4cc5de41f1d88c9ac3 /util/system/file_lock.cpp | |
parent | 5d50718e66d9c037dc587a0211110b7d25a66185 (diff) | |
download | ydb-bd30392c4cc92487950adc375c07adf52da1d592.tar.gz |
Restoring authorship annotation for <mvel@yandex-team.ru>. Commit 1 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 45d91282c5..55160d287f 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); +} |