aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/actor
diff options
context:
space:
mode:
authorAlexander Gololobov <davenger@yandex-team.com>2022-02-10 16:47:38 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:38 +0300
commitfccc62e9bfdce9be2fe7e0f23479da3a5512211a (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/messagebus/actor
parent39608cdb86363c75ce55b2b9a69841c3b71f22cf (diff)
downloadydb-fccc62e9bfdce9be2fe7e0f23479da3a5512211a.tar.gz
Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/actor')
-rw-r--r--library/cpp/messagebus/actor/executor.cpp20
-rw-r--r--library/cpp/messagebus/actor/thread_extra.h22
-rw-r--r--library/cpp/messagebus/actor/what_thread_does.cpp8
3 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/messagebus/actor/executor.cpp b/library/cpp/messagebus/actor/executor.cpp
index b58e07f4bd..7a2227a458 100644
--- a/library/cpp/messagebus/actor/executor.cpp
+++ b/library/cpp/messagebus/actor/executor.cpp
@@ -18,7 +18,7 @@ using namespace NActor::NPrivate;
namespace {
struct THistoryInternal {
struct TRecord {
- TAtomic MaxQueueSize;
+ TAtomic MaxQueueSize;
TRecord()
: MaxQueueSize()
@@ -27,7 +27,7 @@ namespace {
TExecutorHistory::THistoryRecord Capture() {
TExecutorHistory::THistoryRecord r;
- r.MaxQueueSize = AtomicGet(MaxQueueSize);
+ r.MaxQueueSize = AtomicGet(MaxQueueSize);
return r;
}
};
@@ -237,14 +237,14 @@ size_t TExecutor::GetWorkQueueSize() const {
return WorkItems.Size();
}
-using namespace NTSAN;
-
+using namespace NTSAN;
+
ui32 TExecutor::GetMaxQueueSizeAndClear() const {
ui32 max = 0;
for (unsigned i = 0; i < WorkerThreads.size(); ++i) {
- TExecutorWorkerThreadLocalData* wtls = RelaxedLoad(&WorkerThreads[i]->ThreadLocalData);
- max = Max<ui32>(max, RelaxedLoad(&wtls->MaxQueueSize));
- RelaxedStore<ui32>(&wtls->MaxQueueSize, 0);
+ TExecutorWorkerThreadLocalData* wtls = RelaxedLoad(&WorkerThreads[i]->ThreadLocalData);
+ max = Max<ui32>(max, RelaxedLoad(&wtls->MaxQueueSize));
+ RelaxedStore<ui32>(&wtls->MaxQueueSize, 0);
}
return max;
}
@@ -269,7 +269,7 @@ TExecutorStatus TExecutor::GetStatusRecordInternal() const {
ss << "work items: " << GetWorkQueueSize() << "\n";
ss << "workers:\n";
for (unsigned i = 0; i < WorkerThreads.size(); ++i) {
- ss << "-- " << AtomicGet(*AtomicGet(WorkerThreads[i]->WhatThreadDoesLocation)) << "\n";
+ ss << "-- " << AtomicGet(*AtomicGet(WorkerThreads[i]->WhatThreadDoesLocation)) << "\n";
}
r.Status = ss.Str();
}
@@ -299,8 +299,8 @@ TAutoPtr<IWorkItem> TExecutor::DequeueWork() {
auto& wtls = TlsRef(WorkerThreadLocalData);
- if (queueSize > RelaxedLoad(&wtls.MaxQueueSize)) {
- RelaxedStore<ui32>(&wtls.MaxQueueSize, queueSize);
+ if (queueSize > RelaxedLoad(&wtls.MaxQueueSize)) {
+ RelaxedStore<ui32>(&wtls.MaxQueueSize, queueSize);
}
return wi;
diff --git a/library/cpp/messagebus/actor/thread_extra.h b/library/cpp/messagebus/actor/thread_extra.h
index e4f37a9760..b5aa151618 100644
--- a/library/cpp/messagebus/actor/thread_extra.h
+++ b/library/cpp/messagebus/actor/thread_extra.h
@@ -2,28 +2,28 @@
#include <util/thread/singleton.h>
-namespace NTSAN {
+namespace NTSAN {
template <typename T>
inline void RelaxedStore(volatile T* a, T x) {
static_assert(std::is_integral<T>::value || std::is_pointer<T>::value, "expect std::is_integral<T>::value || std::is_pointer<T>::value");
-#ifdef _win_
+#ifdef _win_
*a = x;
-#else
+#else
__atomic_store_n(a, x, __ATOMIC_RELAXED);
-#endif
+#endif
}
-
+
template <typename T>
inline T RelaxedLoad(volatile T* a) {
-#ifdef _win_
+#ifdef _win_
return *a;
-#else
+#else
return __atomic_load_n(a, __ATOMIC_RELAXED);
-#endif
+#endif
}
-
-}
-
+
+}
+
void SetCurrentThreadName(const char* name);
namespace NThreadExtra {
diff --git a/library/cpp/messagebus/actor/what_thread_does.cpp b/library/cpp/messagebus/actor/what_thread_does.cpp
index bce5ccd15e..bebb6a888c 100644
--- a/library/cpp/messagebus/actor/what_thread_does.cpp
+++ b/library/cpp/messagebus/actor/what_thread_does.cpp
@@ -1,6 +1,6 @@
#include "what_thread_does.h"
-#include "thread_extra.h"
+#include "thread_extra.h"
#include <util/system/tls.h>
@@ -8,13 +8,13 @@ Y_POD_STATIC_THREAD(const char*)
WhatThreadDoes;
const char* PushWhatThreadDoes(const char* what) {
- const char* r = NTSAN::RelaxedLoad(&WhatThreadDoes);
- NTSAN::RelaxedStore(&WhatThreadDoes, what);
+ const char* r = NTSAN::RelaxedLoad(&WhatThreadDoes);
+ NTSAN::RelaxedStore(&WhatThreadDoes, what);
return r;
}
void PopWhatThreadDoes(const char* prev) {
- NTSAN::RelaxedStore(&WhatThreadDoes, prev);
+ NTSAN::RelaxedStore(&WhatThreadDoes, prev);
}
const char** WhatThreadDoesLocation() {