aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/threading
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/threading')
-rw-r--r--library/cpp/threading/future/perf/main.cpp6
-rw-r--r--library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp4
-rw-r--r--library/cpp/threading/queue/basic_ut.cpp12
-rw-r--r--library/cpp/threading/queue/mpsc_read_as_filled.h2
-rw-r--r--library/cpp/threading/queue/queue_ut.cpp38
-rw-r--r--library/cpp/threading/queue/unordered_ut.cpp22
-rw-r--r--library/cpp/threading/task_scheduler/task_scheduler.cpp6
-rw-r--r--library/cpp/threading/task_scheduler/task_scheduler.h10
8 files changed, 50 insertions, 50 deletions
diff --git a/library/cpp/threading/future/perf/main.cpp b/library/cpp/threading/future/perf/main.cpp
index 5a0690af47..17a2965498 100644
--- a/library/cpp/threading/future/perf/main.cpp
+++ b/library/cpp/threading/future/perf/main.cpp
@@ -1,7 +1,7 @@
#include <library/cpp/testing/benchmark/bench.h>
#include <library/cpp/threading/future/future.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/xrange.h>
using namespace NThreading;
@@ -38,7 +38,7 @@ Y_CPU_BENCHMARK(AllocPromiseUI64, iface) {
}
Y_CPU_BENCHMARK(AllocPromiseStroka, iface) {
- TestAllocPromise<TString>(iface);
+ TestAllocPromise<TString>(iface);
}
Y_CPU_BENCHMARK(SetPromiseUI64, iface) {
@@ -46,5 +46,5 @@ Y_CPU_BENCHMARK(SetPromiseUI64, iface) {
}
Y_CPU_BENCHMARK(SetPromiseStroka, iface) {
- TestSetPromise<TString>(iface, "test test test");
+ TestSetPromise<TString>(iface, "test test test");
}
diff --git a/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp b/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp
index 7417636864..f842d98ca2 100644
--- a/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp
+++ b/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp
@@ -2,7 +2,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/yexception.h>
Y_UNIT_TEST_SUITE(TestMP) {
@@ -13,7 +13,7 @@ Y_UNIT_TEST_SUITE(TestMP) {
}
};
- TString s;
+ TString s;
try {
NYmp::ParallelForStaticAutoChunk(0, 10, f);
diff --git a/library/cpp/threading/queue/basic_ut.cpp b/library/cpp/threading/queue/basic_ut.cpp
index 5f56f8583e..f6b8d0f810 100644
--- a/library/cpp/threading/queue/basic_ut.cpp
+++ b/library/cpp/threading/queue/basic_ut.cpp
@@ -4,10 +4,10 @@
#include "ut_helpers.h"
-template <typename TQueueType>
+template <typename TQueueType>
class TQueueTestsInSingleThread: public TTestBase {
private:
- using TSelf = TQueueTestsInSingleThread<TQueueType>;
+ using TSelf = TQueueTestsInSingleThread<TQueueType>;
using TLink = TIntrusiveLink;
UNIT_TEST_SUITE_DEMANGLE(TSelf);
@@ -18,7 +18,7 @@ private:
public:
void OnePushOnePop() {
- TQueueType queue;
+ TQueueType queue;
auto popped = queue.Pop();
UNIT_ASSERT_VALUES_EQUAL(popped, nullptr);
@@ -33,7 +33,7 @@ public:
};
void OnePushOnePop_Repeat1M() {
- TQueueType queue;
+ TQueueType queue;
TLink msg;
auto popped = queue.Pop();
@@ -54,7 +54,7 @@ public:
class TCycleThread: public ISimpleThread {
public:
void* ThreadProc() override {
- TQueueType queue;
+ TQueueType queue;
TLink msg;
auto popped = queue.Pop();
UNIT_ASSERT_VALUES_EQUAL(popped, nullptr);
@@ -71,7 +71,7 @@ public:
}
};
- TVector<TAutoPtr<TCycleThread>> cyclers;
+ TVector<TAutoPtr<TCycleThread>> cyclers;
for (size_t i = 0; i < NUMBER_OF_THREADS; ++i) {
cyclers.emplace_back(new TCycleThread);
diff --git a/library/cpp/threading/queue/mpsc_read_as_filled.h b/library/cpp/threading/queue/mpsc_read_as_filled.h
index be33ba5a58..de8f596833 100644
--- a/library/cpp/threading/queue/mpsc_read_as_filled.h
+++ b/library/cpp/threading/queue/mpsc_read_as_filled.h
@@ -544,7 +544,7 @@ namespace NThreading {
using TBunchBase = TEmpty;
template <typename TElem, typename... TRest>
- using TContainer = TDeque<TElem, TRest...>;
+ using TContainer = TDeque<TElem, TRest...>;
static constexpr bool DeleteItems = true;
};
diff --git a/library/cpp/threading/queue/queue_ut.cpp b/library/cpp/threading/queue/queue_ut.cpp
index 80eca147da..299025adcc 100644
--- a/library/cpp/threading/queue/queue_ut.cpp
+++ b/library/cpp/threading/queue/queue_ut.cpp
@@ -5,10 +5,10 @@
typedef void* TMsgLink;
-template <typename TQueueType>
+template <typename TQueueType>
class TQueueTestProcs: public TTestBase {
private:
- UNIT_TEST_SUITE_DEMANGLE(TQueueTestProcs<TQueueType>);
+ UNIT_TEST_SUITE_DEMANGLE(TQueueTestProcs<TQueueType>);
UNIT_TEST(Threads2_Push1M_Threads1_Pop2M)
UNIT_TEST(Threads4_Push1M_Threads1_Pop4M)
UNIT_TEST(Threads8_RndPush100K_Threads8_Queues)
@@ -21,7 +21,7 @@ private:
public:
void Push1M_Pop1M() {
- TQueueType queue;
+ TQueueType queue;
TMsgLink msg = &queue;
auto pmsg = queue.Pop();
@@ -41,17 +41,17 @@ public:
}
void Threads2_Push1M_Threads1_Pop2M() {
- TQueueType queue;
+ TQueueType queue;
class TPusherThread: public ISimpleThread {
public:
- TPusherThread(TQueueType& theQueue, char* start)
- : Queue(theQueue)
+ TPusherThread(TQueueType& theQueue, char* start)
+ : Queue(theQueue)
, Arg(start)
{
}
- TQueueType& Queue;
+ TQueueType& Queue;
char* Arg;
void* ThreadProc() override {
@@ -79,17 +79,17 @@ public:
}
void Threads4_Push1M_Threads1_Pop4M() {
- TQueueType queue;
+ TQueueType queue;
class TPusherThread: public ISimpleThread {
public:
- TPusherThread(TQueueType& theQueue, char* start)
- : Queue(theQueue)
+ TPusherThread(TQueueType& theQueue, char* start)
+ : Queue(theQueue)
, Arg(start)
{
}
- TQueueType& Queue;
+ TQueueType& Queue;
char* Arg;
void* ThreadProc() override {
@@ -122,17 +122,17 @@ public:
template <size_t NUMBER_OF_PUSHERS, size_t NUMBER_OF_QUEUES>
void ManyRndPush100K_ManyQueues() {
- TQueueType queue[NUMBER_OF_QUEUES];
+ TQueueType queue[NUMBER_OF_QUEUES];
class TPusherThread: public ISimpleThread {
public:
- TPusherThread(TQueueType* queues, char* start)
+ TPusherThread(TQueueType* queues, char* start)
: Queues(queues)
, Arg(start)
{
}
- TQueueType* Queues;
+ TQueueType* Queues;
char* Arg;
void* ThreadProc() override {
@@ -157,13 +157,13 @@ public:
class TPopperThread: public ISimpleThread {
public:
- TPopperThread(TQueueType* theQueue, char* base)
- : Queue(theQueue)
+ TPopperThread(TQueueType* theQueue, char* base)
+ : Queue(theQueue)
, Base(base)
{
}
- TQueueType* Queue;
+ TQueueType* Queue;
char* Base;
void* ThreadProc() override {
@@ -197,8 +197,8 @@ public:
}
};
- TVector<TAutoPtr<TPopperThread>> poppers;
- TVector<TAutoPtr<TPusherThread>> pushers;
+ TVector<TAutoPtr<TPopperThread>> poppers;
+ TVector<TAutoPtr<TPusherThread>> pushers;
for (size_t i = 0; i < NUMBER_OF_QUEUES; ++i) {
poppers.emplace_back(new TPopperThread(&queue[i], (char*)&queue));
diff --git a/library/cpp/threading/queue/unordered_ut.cpp b/library/cpp/threading/queue/unordered_ut.cpp
index a43b7f520e..494cffcbe5 100644
--- a/library/cpp/threading/queue/unordered_ut.cpp
+++ b/library/cpp/threading/queue/unordered_ut.cpp
@@ -6,19 +6,19 @@
#include "ut_helpers.h"
-template <typename TQueueType>
+template <typename TQueueType>
class TTestUnorderedQueue: public TTestBase {
private:
using TLink = TIntrusiveLink;
- UNIT_TEST_SUITE_DEMANGLE(TTestUnorderedQueue<TQueueType>);
+ UNIT_TEST_SUITE_DEMANGLE(TTestUnorderedQueue<TQueueType>);
UNIT_TEST(Push1M_Pop1M_Unordered)
UNIT_TEST_SUITE_END();
public:
void Push1M_Pop1M_Unordered() {
constexpr int REPEAT = 1000000;
- TQueueType queue;
+ TQueueType queue;
TLink msg[REPEAT];
auto pmsg = queue.Pop();
@@ -28,7 +28,7 @@ public:
queue.Push(&msg[i]);
}
- TVector<TLink*> popped;
+ TVector<TLink*> popped;
popped.reserve(REPEAT);
for (int i = 0; i < REPEAT; ++i) {
popped.push_back((TLink*)queue.Pop());
@@ -44,17 +44,17 @@ public:
}
};
-template <typename TQueueType>
+template <typename TQueueType>
class TTestWeakQueue: public TTestBase {
private:
- UNIT_TEST_SUITE_DEMANGLE(TTestWeakQueue<TQueueType>);
+ UNIT_TEST_SUITE_DEMANGLE(TTestWeakQueue<TQueueType>);
UNIT_TEST(Threads8_Rnd_Exchange)
UNIT_TEST_SUITE_END();
public:
template <ui16 COUNT = 48, ui32 MSG_COUNT = 10000>
void ManyThreadsRndExchange() {
- TQueueType queues[COUNT];
+ TQueueType queues[COUNT];
class TWorker: public ISimpleThread {
public:
@@ -68,9 +68,9 @@ public:
{
}
- TQueueType* Queues;
+ TQueueType* Queues;
ui16 MineQueue;
- TVector<uintptr_t> Received;
+ TVector<uintptr_t> Received;
TAtomic* PushDone;
void* ThreadProc() override {
@@ -120,7 +120,7 @@ public:
}
};
- TVector<TAutoPtr<TWorker>> workers;
+ TVector<TAutoPtr<TWorker>> workers;
TAtomic pushDone = 0;
for (ui32 i = 0; i < COUNT; ++i) {
@@ -128,7 +128,7 @@ public:
workers.back()->Start();
}
- TVector<uintptr_t> all;
+ TVector<uintptr_t> all;
for (ui32 i = 0; i < COUNT; ++i) {
workers[i]->Join();
all.insert(all.begin(),
diff --git a/library/cpp/threading/task_scheduler/task_scheduler.cpp b/library/cpp/threading/task_scheduler/task_scheduler.cpp
index 174dde4bf7..4e2239c2d7 100644
--- a/library/cpp/threading/task_scheduler/task_scheduler.cpp
+++ b/library/cpp/threading/task_scheduler/task_scheduler.cpp
@@ -18,8 +18,8 @@ public:
{
}
- TString DebugState = "?";
- TString DebugId = "";
+ TString DebugState = "?";
+ TString DebugId = "";
private:
void* ThreadProc() noexcept override {
Scheduler_.WorkerFunc(this);
@@ -150,7 +150,7 @@ bool TTaskScheduler::Add(IRepeatedTaskRef task, TDuration period) {
const bool debugOutput = false;
-void TTaskScheduler::ChangeDebugState(TWorkerThread* thread, const TString& state) {
+void TTaskScheduler::ChangeDebugState(TWorkerThread* thread, const TString& state) {
if (!debugOutput) {
Y_UNUSED(thread);
Y_UNUSED(state);
diff --git a/library/cpp/threading/task_scheduler/task_scheduler.h b/library/cpp/threading/task_scheduler/task_scheduler.h
index df4da941a8..e2381c2b38 100644
--- a/library/cpp/threading/task_scheduler/task_scheduler.h
+++ b/library/cpp/threading/task_scheduler/task_scheduler.h
@@ -40,10 +40,10 @@ private:
TWorkerThread* WaitingWorker = nullptr;
};
- using TQueueType = TMultiMap<TInstant, TTaskHolder>;
- using TQueueIterator = TQueueType::iterator;
+ using TQueueType = TMultiMap<TInstant, TTaskHolder>;
+ using TQueueIterator = TQueueType::iterator;
private:
- void ChangeDebugState(TWorkerThread* thread, const TString& state);
+ void ChangeDebugState(TWorkerThread* thread, const TString& state);
void ChooseFromQueue(TQueueIterator& toWait);
bool Wait(TWorkerThread* thread, TQueueIterator& toWait);
@@ -52,12 +52,12 @@ private:
bool IsStopped_ = false;
TAtomic TaskCounter_ = 0;
- TQueueType Queue_;
+ TQueueType Queue_;
TCondVar CondVar_;
TMutex Lock_;
- TVector<TAutoPtr<TWorkerThread>> Workers_;
+ TVector<TAutoPtr<TWorkerThread>> Workers_;
const size_t MaxTaskCount_;
};