aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/thread_ut.cpp
diff options
context:
space:
mode:
authorcerevra <cerevra@yandex-team.ru>2022-02-10 16:45:58 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:58 +0300
commitbf41dd01f6c920583e9faae7cd55ed25e547e052 (patch)
treeec7c8c285ffa648a5c5efeff453787a15ab811ac /util/system/thread_ut.cpp
parente2c3e3004f7cd68441cefcfa4aaccd3d8051c846 (diff)
downloadydb-bf41dd01f6c920583e9faae7cd55ed25e547e052.tar.gz
Restoring authorship annotation for <cerevra@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/thread_ut.cpp')
-rw-r--r--util/system/thread_ut.cpp94
1 files changed, 47 insertions, 47 deletions
diff --git a/util/system/thread_ut.cpp b/util/system/thread_ut.cpp
index d820898fd5..0a50a36e59 100644
--- a/util/system/thread_ut.cpp
+++ b/util/system/thread_ut.cpp
@@ -178,52 +178,52 @@ Y_UNIT_TEST_SUITE(TSysThreadTest) {
UNIT_ASSERT(sl.StackBegin);
UNIT_ASSERT(sl.StackLength > 0);
}
-
- Y_UNIT_TEST(TestFunc) {
- std::atomic_bool flag = {false};
- TThread thread([&flag]() { flag = true; });
-
- thread.Start();
- UNIT_ASSERT_VALUES_EQUAL(thread.Join(), nullptr);
- UNIT_ASSERT(flag);
- }
-
- Y_UNIT_TEST(TestCopyFunc) {
- std::atomic_bool flag = {false};
- auto func = [&flag]() { flag = true; };
-
- TThread thread(func);
- thread.Start();
- UNIT_ASSERT_VALUES_EQUAL(thread.Join(), nullptr);
-
- TThread thread2(func);
- thread2.Start();
- UNIT_ASSERT_VALUES_EQUAL(thread2.Join(), nullptr);
-
- UNIT_ASSERT(flag);
- }
-
- Y_UNIT_TEST(TestCallable) {
- std::atomic_bool flag = {false};
-
+
+ Y_UNIT_TEST(TestFunc) {
+ std::atomic_bool flag = {false};
+ TThread thread([&flag]() { flag = true; });
+
+ thread.Start();
+ UNIT_ASSERT_VALUES_EQUAL(thread.Join(), nullptr);
+ UNIT_ASSERT(flag);
+ }
+
+ Y_UNIT_TEST(TestCopyFunc) {
+ std::atomic_bool flag = {false};
+ auto func = [&flag]() { flag = true; };
+
+ TThread thread(func);
+ thread.Start();
+ UNIT_ASSERT_VALUES_EQUAL(thread.Join(), nullptr);
+
+ TThread thread2(func);
+ thread2.Start();
+ UNIT_ASSERT_VALUES_EQUAL(thread2.Join(), nullptr);
+
+ UNIT_ASSERT(flag);
+ }
+
+ Y_UNIT_TEST(TestCallable) {
+ std::atomic_bool flag = {false};
+
struct TCallable: TMoveOnly {
- std::atomic_bool* Flag_;
-
- TCallable(std::atomic_bool* flag)
- : Flag_(flag)
- {
- }
-
- void operator()() {
- *Flag_ = true;
- }
- };
-
- TCallable foo(&flag);
- TThread thread(std::move(foo));
-
- thread.Start();
- UNIT_ASSERT_VALUES_EQUAL(thread.Join(), nullptr);
- UNIT_ASSERT(flag);
- }
+ std::atomic_bool* Flag_;
+
+ TCallable(std::atomic_bool* flag)
+ : Flag_(flag)
+ {
+ }
+
+ void operator()() {
+ *Flag_ = true;
+ }
+ };
+
+ TCallable foo(&flag);
+ TThread thread(std::move(foo));
+
+ thread.Start();
+ UNIT_ASSERT_VALUES_EQUAL(thread.Join(), nullptr);
+ UNIT_ASSERT(flag);
+ }
};