diff options
author | tejblum <tejblum@yandex-team.ru> | 2022-02-10 16:48:02 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:02 +0300 |
commit | 6ab7e5f5ada0643a48d393717f443bd548706ffc (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util/system/rwlock.cpp | |
parent | 2bf39531b4f50b889e946ac4866018678a4fb281 (diff) | |
download | ydb-6ab7e5f5ada0643a48d393717f443bd548706ffc.tar.gz |
Restoring authorship annotation for <tejblum@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/rwlock.cpp')
-rw-r--r-- | util/system/rwlock.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp index 66b47e2a7e..bb3dcbf188 100644 --- a/util/system/rwlock.cpp +++ b/util/system/rwlock.cpp @@ -1,7 +1,7 @@ -#include "rwlock.h" +#include "rwlock.h" #include "mutex.h" #include "condvar.h" - + #include <util/generic/yexception.h> #if defined(_unix_) @@ -39,7 +39,7 @@ TRWMutex::TImpl::TImpl() , BlockedWriters_(0) { } - + TRWMutex::TImpl::~TImpl() { Y_VERIFY(State_ == 0, "failure, State_ != 0"); Y_VERIFY(BlockedWriters_ == 0, "failure, BlockedWriters_ != 0"); @@ -52,11 +52,11 @@ void TRWMutex::TImpl::AcquireRead() noexcept { } ++State_; - } + } ReadCond_.Signal(); } - + bool TRWMutex::TImpl::TryAcquireRead() noexcept { with_lock (Lock_) { if (BlockedWriters_ || State_ < 0) { @@ -128,18 +128,18 @@ void TRWMutex::TImpl::Release() noexcept { } else if (BlockedWriters_) { Lock_.Release(); WriteCond_.Signal(); - } + } } else { State_ = 0; if (BlockedWriters_) { Lock_.Release(); WriteCond_.Signal(); - } else { + } else { Lock_.Release(); ReadCond_.Signal(); - } - } + } + } } #else /* POSIX threads */ @@ -212,7 +212,7 @@ void TRWMutex::TImpl::Release() noexcept { Y_VERIFY(result == 0, "rwlock unlock failed (%s)", LastSystemErrorText(result)); } -#endif +#endif TRWMutex::TRWMutex() : Impl_(new TImpl()) |