summaryrefslogtreecommitdiffstats
path: root/util/system/file_lock.cpp
diff options
context:
space:
mode:
authorsvshevtsov <[email protected]>2022-02-10 16:49:37 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:49:37 +0300
commit657337012a264721d58c470b4e9e796611f3c492 (patch)
tree82753fd92cf7cc2dea4e522a945ed570131f920b /util/system/file_lock.cpp
parent44f31b316af517a4fbc6a82ebed8a1c51807deac (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/system/file_lock.cpp')
-rw-r--r--util/system/file_lock.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/util/system/file_lock.cpp b/util/system/file_lock.cpp
index 45d91282c5b..81558eb09fb 100644
--- a/util/system/file_lock.cpp
+++ b/util/system/file_lock.cpp
@@ -1,10 +1,10 @@
#include "file_lock.h"
#include "flock.h"
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
#include <cerrno>
-
+
namespace {
int GetMode(const EFileLockType type) {
switch (type) {
@@ -29,18 +29,18 @@ void TFileLock::Acquire() {
Flock(GetMode(Type));
}
-bool TFileLock::TryAcquire() {
- try {
+bool TFileLock::TryAcquire() {
+ try {
Flock(GetMode(Type) | LOCK_NB);
- return true;
- } catch (const TSystemError& e) {
- if (e.Status() != EWOULDBLOCK) {
- throw;
- }
- return false;
- }
-}
-
+ return true;
+ } catch (const TSystemError& e) {
+ if (e.Status() != EWOULDBLOCK) {
+ throw;
+ }
+ return false;
+ }
+}
+
void TFileLock::Release() {
Flock(LOCK_UN);
}