aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/guard_ut.cpp
diff options
context:
space:
mode:
authornsofya <nsofya@yandex-team.ru>2022-02-10 16:49:52 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:52 +0300
commit3f5911a056d3dbc4bfd724740244a3a9c11575ef (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/system/guard_ut.cpp
parent2ea6d2c7415473747379b1c65468241b431057ad (diff)
downloadydb-3f5911a056d3dbc4bfd724740244a3a9c11575ef.tar.gz
Restoring authorship annotation for <nsofya@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/guard_ut.cpp')
-rw-r--r--util/system/guard_ut.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/util/system/guard_ut.cpp b/util/system/guard_ut.cpp
index c470ef788d..404ede99ab 100644
--- a/util/system/guard_ut.cpp
+++ b/util/system/guard_ut.cpp
@@ -1,5 +1,5 @@
#include "guard.h"
-#include "rwlock.h"
+#include "rwlock.h"
#include <library/cpp/testing/unittest/registar.h>
@@ -12,7 +12,7 @@ struct TTestGuard: public TTestBase {
UNIT_TEST(TestMove)
UNIT_TEST(TestSync)
UNIT_TEST(TestUnguard)
- UNIT_TEST(TestTryReadGuard)
+ UNIT_TEST(TestTryReadGuard)
UNIT_TEST(TestWithLock)
UNIT_TEST(TestWithLockScope);
UNIT_TEST_SUITE_END();
@@ -129,29 +129,29 @@ struct TTestGuard: public TTestBase {
}
UNIT_ASSERT(!checker.guarded);
}
-
- void TestTryReadGuard() {
- TRWMutex mutex;
- {
- TTryReadGuard tryGuard(mutex);
- UNIT_ASSERT(tryGuard.WasAcquired());
- TReadGuard readGuard(mutex);
- TTryReadGuard anotherTryGuard(mutex);
- UNIT_ASSERT(tryGuard.WasAcquired());
- }
- {
- TReadGuard readGuard(mutex);
- TTryReadGuard tryGuard(mutex);
- UNIT_ASSERT(tryGuard.WasAcquired());
- }
- {
- TWriteGuard writeGuard(mutex);
- TTryReadGuard tryGuard(mutex);
- UNIT_ASSERT(!tryGuard.WasAcquired());
- }
- TTryReadGuard tryGuard(mutex);
- UNIT_ASSERT(tryGuard.WasAcquired());
- }
+
+ void TestTryReadGuard() {
+ TRWMutex mutex;
+ {
+ TTryReadGuard tryGuard(mutex);
+ UNIT_ASSERT(tryGuard.WasAcquired());
+ TReadGuard readGuard(mutex);
+ TTryReadGuard anotherTryGuard(mutex);
+ UNIT_ASSERT(tryGuard.WasAcquired());
+ }
+ {
+ TReadGuard readGuard(mutex);
+ TTryReadGuard tryGuard(mutex);
+ UNIT_ASSERT(tryGuard.WasAcquired());
+ }
+ {
+ TWriteGuard writeGuard(mutex);
+ TTryReadGuard tryGuard(mutex);
+ UNIT_ASSERT(!tryGuard.WasAcquired());
+ }
+ TTryReadGuard tryGuard(mutex);
+ UNIT_ASSERT(tryGuard.WasAcquired());
+ }
int WithLockIncrement(TGuardChecker& m, int n) {
with_lock (m) {