aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authorand42 <and42@yandex-team.ru>2022-02-10 16:47:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:12 +0300
commit984590e9d9d7c0f912885d93ae78be402ae7b4f4 (patch)
tree339adc63bce23800021202ae4a8328a843dc447a /util/system
parent4fc9a1a64db469cc94894abfec740aa5c9e9789b (diff)
downloadydb-984590e9d9d7c0f912885d93ae78be402ae7b4f4.tar.gz
Restoring authorship annotation for <and42@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system')
-rw-r--r--util/system/atexit.cpp8
-rw-r--r--util/system/event.cpp20
-rw-r--r--util/system/event_ut.cpp26
3 files changed, 27 insertions, 27 deletions
diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp
index 25dc673b5f..74fb10b6b1 100644
--- a/util/system/atexit.cpp
+++ b/util/system/atexit.cpp
@@ -45,15 +45,15 @@ namespace {
Y_ASSERT(c);
Items_.pop();
-
+
{
auto unguard = Unguard(guard);
-
+
try {
- c->Func(c->Ctx);
+ c->Func(c->Ctx);
} catch (...) {
// ¯\_(ツ)_/¯
- }
+ }
}
}
}
diff --git a/util/system/event.cpp b/util/system/event.cpp
index 9771e44a89..79b3cdb291 100644
--- a/util/system/event.cpp
+++ b/util/system/event.cpp
@@ -3,7 +3,7 @@
#include <cstdio>
-#include "atomic.h"
+#include "atomic.h"
#include "event.h"
#include "mutex.h"
#include "condvar.h"
@@ -47,17 +47,17 @@ public:
}
#else
inline TEvImpl(ResetMode rmode)
- : Manual(rmode == rManual ? true : false)
+ : Manual(rmode == rManual ? true : false)
{
}
inline void Signal() noexcept {
- if (Manual && AtomicGet(Signaled)) {
+ if (Manual && AtomicGet(Signaled)) {
return; // shortcut
}
with_lock (Mutex) {
- AtomicSet(Signaled, 1);
+ AtomicSet(Signaled, 1);
}
if (Manual) {
@@ -68,27 +68,27 @@ public:
}
inline void Reset() noexcept {
- AtomicSet(Signaled, 0);
+ AtomicSet(Signaled, 0);
}
inline bool WaitD(TInstant deadLine) noexcept {
- if (Manual && AtomicGet(Signaled)) {
+ if (Manual && AtomicGet(Signaled)) {
return true; // shortcut
}
bool resSignaled = true;
with_lock (Mutex) {
- while (!AtomicGet(Signaled)) {
+ while (!AtomicGet(Signaled)) {
if (!Cond.WaitD(Mutex, deadLine)) {
- resSignaled = AtomicGet(Signaled); // timed out, but Signaled could have been set
+ resSignaled = AtomicGet(Signaled); // timed out, but Signaled could have been set
break;
}
}
if (!Manual) {
- AtomicSet(Signaled, 0);
+ AtomicSet(Signaled, 0);
}
}
@@ -102,7 +102,7 @@ private:
#else
TCondVar Cond;
TMutex Mutex;
- TAtomic Signaled = 0;
+ TAtomic Signaled = 0;
bool Manual;
#endif
};
diff --git a/util/system/event_ut.cpp b/util/system/event_ut.cpp
index d6f14c04cb..2506cb7a91 100644
--- a/util/system/event_ut.cpp
+++ b/util/system/event_ut.cpp
@@ -96,22 +96,22 @@ Y_UNIT_TEST_SUITE(EventTest) {
}
Y_UNIT_TEST(ConcurrentSignalAndWaitTest) {
- // test for problem detected by thread-sanitizer (signal/wait race) SEARCH-2113
- const size_t limit = 200;
- TManualEvent event[limit];
+ // test for problem detected by thread-sanitizer (signal/wait race) SEARCH-2113
+ const size_t limit = 200;
+ TManualEvent event[limit];
TThreadPool queue;
- queue.Start(limit);
+ queue.Start(limit);
TVector<THolder<IObjectInQueue>> tasks;
- for (size_t i = 0; i < limit; ++i) {
+ for (size_t i = 0; i < limit; ++i) {
tasks.emplace_back(MakeHolder<TSignalTask>(event[i]));
- UNIT_ASSERT(queue.Add(tasks.back().Get()));
- }
- for (size_t i = limit; i != 0; --i) {
- UNIT_ASSERT(event[i - 1].WaitT(TDuration::Seconds(90)));
- }
- queue.Stop();
- }
-
+ UNIT_ASSERT(queue.Add(tasks.back().Get()));
+ }
+ for (size_t i = limit; i != 0; --i) {
+ UNIT_ASSERT(event[i - 1].WaitT(TDuration::Seconds(90)));
+ }
+ queue.Stop();
+ }
+
/** Test for a problem: http://nga.at.yandex-team.ru/5772 */
Y_UNIT_TEST(DestructorBeforeSignalFinishTest) {
return;