diff options
author | loudhorr <[email protected]> | 2022-02-10 16:46:26 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:26 +0300 |
commit | f46e9ad72f0ae2f165fb2886ea34043ff5995753 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system/file_lock.cpp | |
parent | cda908cacb24be13e419866da89ff4fbeea31f89 (diff) |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/system/file_lock.cpp')
-rw-r--r-- | util/system/file_lock.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/util/system/file_lock.cpp b/util/system/file_lock.cpp index ef8c10a1900..45d91282c5b 100644 --- a/util/system/file_lock.cpp +++ b/util/system/file_lock.cpp @@ -5,33 +5,33 @@ #include <cerrno> -namespace { - int GetMode(const EFileLockType type) { - switch (type) { - case EFileLockType::Exclusive: - return LOCK_EX; - case EFileLockType::Shared: - return LOCK_SH; +namespace { + int GetMode(const EFileLockType type) { + switch (type) { + case EFileLockType::Exclusive: + return LOCK_EX; + case EFileLockType::Shared: + return LOCK_SH; default: Y_UNREACHABLE(); - } + } Y_UNREACHABLE(); - } -} - -TFileLock::TFileLock(const TString& filename, const EFileLockType type) - : TFile(filename, OpenAlways | RdOnly) - , Type(type) + } +} + +TFileLock::TFileLock(const TString& filename, const EFileLockType type) + : TFile(filename, OpenAlways | RdOnly) + , Type(type) { } void TFileLock::Acquire() { - Flock(GetMode(Type)); + Flock(GetMode(Type)); } bool TFileLock::TryAcquire() { try { - Flock(GetMode(Type) | LOCK_NB); + Flock(GetMode(Type) | LOCK_NB); return true; } catch (const TSystemError& e) { if (e.Status() != EWOULDBLOCK) { |