aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-10 16:48:02 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:02 +0300
commita61e8c559b6b690a019253067224d595e3d642f1 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp
parent659131349be7796c633c453b4d8b4fa20b8c6ee9 (diff)
downloadydb-a61e8c559b6b690a019253067224d595e3d642f1.tar.gz
Restoring authorship annotation for <arcadia-devtools@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/lfalloc/lf_allocX64.h2
-rw-r--r--library/cpp/threading/local_executor/tbb_local_executor.cpp106
-rw-r--r--library/cpp/threading/local_executor/tbb_local_executor.h98
-rw-r--r--library/cpp/threading/local_executor/ya.make2
4 files changed, 104 insertions, 104 deletions
diff --git a/library/cpp/lfalloc/lf_allocX64.h b/library/cpp/lfalloc/lf_allocX64.h
index 20df33b60d..fd2a906d6f 100644
--- a/library/cpp/lfalloc/lf_allocX64.h
+++ b/library/cpp/lfalloc/lf_allocX64.h
@@ -1679,7 +1679,7 @@ static void DebugTraceMMgr(const char* pszFormat, ...) // __cdecl
#ifdef _win_
OutputDebugStringA(buff);
#else
- fputs(buff, stderr);
+ fputs(buff, stderr);
#endif
}
diff --git a/library/cpp/threading/local_executor/tbb_local_executor.cpp b/library/cpp/threading/local_executor/tbb_local_executor.cpp
index 9903ef33de..65d6659443 100644
--- a/library/cpp/threading/local_executor/tbb_local_executor.cpp
+++ b/library/cpp/threading/local_executor/tbb_local_executor.cpp
@@ -1,53 +1,53 @@
-#include "tbb_local_executor.h"
-
-template <bool RespectTls>
-void NPar::TTbbLocalExecutor<RespectTls>::SubmitAsyncTasks(TLocallyExecutableFunction exec, int firstId, int lastId) {
- for (int i = firstId; i < lastId; ++i) {
- Group.run([=] { exec(i); });
- }
-}
-
-template <bool RespectTls>
-int NPar::TTbbLocalExecutor<RespectTls>::GetThreadCount() const noexcept {
- return NumberOfTbbThreads - 1;
-}
-
-template <bool RespectTls>
-int NPar::TTbbLocalExecutor<RespectTls>::GetWorkerThreadId() const noexcept {
- return TbbArena.execute([] {
- return tbb::this_task_arena::current_thread_index();
- });
-}
-
-template <bool RespectTls>
-void NPar::TTbbLocalExecutor<RespectTls>::Exec(TIntrusivePtr<ILocallyExecutable> exec, int id, int flags) {
- if (flags & WAIT_COMPLETE) {
- exec->LocalExec(id);
- } else {
- TbbArena.execute([=] {
- SubmitAsyncTasks([=] (int id) { exec->LocalExec(id); }, id, id + 1);
- });
- }
-}
-
-template <bool RespectTls>
-void NPar::TTbbLocalExecutor<RespectTls>::ExecRange(TIntrusivePtr<ILocallyExecutable> exec, int firstId, int lastId, int flags) {
- if (flags & WAIT_COMPLETE) {
- TbbArena.execute([=] {
- if (RespectTls) {
- tbb::this_task_arena::isolate([=]{
- tbb::parallel_for(firstId, lastId, [=] (int id) { exec->LocalExec(id); });
- });
- } else {
- tbb::parallel_for(firstId, lastId, [=] (int id) { exec->LocalExec(id); });
- }
- });
- } else {
- TbbArena.execute([=] {
- SubmitAsyncTasks([=] (int id) { exec->LocalExec(id); }, firstId, lastId);
- });
- }
-}
-
-template class NPar::TTbbLocalExecutor<true>;
-template class NPar::TTbbLocalExecutor<false>;
+#include "tbb_local_executor.h"
+
+template <bool RespectTls>
+void NPar::TTbbLocalExecutor<RespectTls>::SubmitAsyncTasks(TLocallyExecutableFunction exec, int firstId, int lastId) {
+ for (int i = firstId; i < lastId; ++i) {
+ Group.run([=] { exec(i); });
+ }
+}
+
+template <bool RespectTls>
+int NPar::TTbbLocalExecutor<RespectTls>::GetThreadCount() const noexcept {
+ return NumberOfTbbThreads - 1;
+}
+
+template <bool RespectTls>
+int NPar::TTbbLocalExecutor<RespectTls>::GetWorkerThreadId() const noexcept {
+ return TbbArena.execute([] {
+ return tbb::this_task_arena::current_thread_index();
+ });
+}
+
+template <bool RespectTls>
+void NPar::TTbbLocalExecutor<RespectTls>::Exec(TIntrusivePtr<ILocallyExecutable> exec, int id, int flags) {
+ if (flags & WAIT_COMPLETE) {
+ exec->LocalExec(id);
+ } else {
+ TbbArena.execute([=] {
+ SubmitAsyncTasks([=] (int id) { exec->LocalExec(id); }, id, id + 1);
+ });
+ }
+}
+
+template <bool RespectTls>
+void NPar::TTbbLocalExecutor<RespectTls>::ExecRange(TIntrusivePtr<ILocallyExecutable> exec, int firstId, int lastId, int flags) {
+ if (flags & WAIT_COMPLETE) {
+ TbbArena.execute([=] {
+ if (RespectTls) {
+ tbb::this_task_arena::isolate([=]{
+ tbb::parallel_for(firstId, lastId, [=] (int id) { exec->LocalExec(id); });
+ });
+ } else {
+ tbb::parallel_for(firstId, lastId, [=] (int id) { exec->LocalExec(id); });
+ }
+ });
+ } else {
+ TbbArena.execute([=] {
+ SubmitAsyncTasks([=] (int id) { exec->LocalExec(id); }, firstId, lastId);
+ });
+ }
+}
+
+template class NPar::TTbbLocalExecutor<true>;
+template class NPar::TTbbLocalExecutor<false>;
diff --git a/library/cpp/threading/local_executor/tbb_local_executor.h b/library/cpp/threading/local_executor/tbb_local_executor.h
index f62694d6f7..8d790db18c 100644
--- a/library/cpp/threading/local_executor/tbb_local_executor.h
+++ b/library/cpp/threading/local_executor/tbb_local_executor.h
@@ -1,49 +1,49 @@
-#pragma once
-
-#include "local_executor.h"
-#define __TBB_TASK_ISOLATION 1
-#define __TBB_NO_IMPLICIT_LINKAGE 1
-
-#include <contrib/libs/tbb/include/tbb/blocked_range.h>
-#include <contrib/libs/tbb/include/tbb/parallel_for.h>
-#include <contrib/libs/tbb/include/tbb/task_arena.h>
-#include <contrib/libs/tbb/include/tbb/task_group.h>
-
-namespace NPar {
- template <bool RespectTls = false>
- class TTbbLocalExecutor final: public ILocalExecutor {
- public:
- TTbbLocalExecutor(int nThreads)
- : ILocalExecutor()
- , TbbArena(nThreads)
- , NumberOfTbbThreads(nThreads) {}
- ~TTbbLocalExecutor() noexcept override {}
-
- // 0-based ILocalExecutor worker thread identification
- virtual int GetWorkerThreadId() const noexcept override;
- virtual int GetThreadCount() const noexcept override;
-
- // Add task for further execution.
- //
- // @param exec Task description.
- // @param id Task argument.
- // @param flags Bitmask composed by `HIGH_PRIORITY`, `MED_PRIORITY`, `LOW_PRIORITY`
- // and `WAIT_COMPLETE`.
- virtual void Exec(TIntrusivePtr<ILocallyExecutable> exec, int id, int flags) override;
-
- // Add tasks range for further execution.
- //
- // @param exec Task description.
- // @param firstId, lastId Task arguments [firstId, lastId)
- // @param flags Same as for `Exec`.
- virtual void ExecRange(TIntrusivePtr<ILocallyExecutable> exec, int firstId, int lastId, int flags) override;
-
- // Submit tasks for async run
- void SubmitAsyncTasks(TLocallyExecutableFunction exec, int firstId, int lastId);
-
- private:
- mutable tbb::task_arena TbbArena;
- tbb::task_group Group;
- int NumberOfTbbThreads;
- };
-}
+#pragma once
+
+#include "local_executor.h"
+#define __TBB_TASK_ISOLATION 1
+#define __TBB_NO_IMPLICIT_LINKAGE 1
+
+#include <contrib/libs/tbb/include/tbb/blocked_range.h>
+#include <contrib/libs/tbb/include/tbb/parallel_for.h>
+#include <contrib/libs/tbb/include/tbb/task_arena.h>
+#include <contrib/libs/tbb/include/tbb/task_group.h>
+
+namespace NPar {
+ template <bool RespectTls = false>
+ class TTbbLocalExecutor final: public ILocalExecutor {
+ public:
+ TTbbLocalExecutor(int nThreads)
+ : ILocalExecutor()
+ , TbbArena(nThreads)
+ , NumberOfTbbThreads(nThreads) {}
+ ~TTbbLocalExecutor() noexcept override {}
+
+ // 0-based ILocalExecutor worker thread identification
+ virtual int GetWorkerThreadId() const noexcept override;
+ virtual int GetThreadCount() const noexcept override;
+
+ // Add task for further execution.
+ //
+ // @param exec Task description.
+ // @param id Task argument.
+ // @param flags Bitmask composed by `HIGH_PRIORITY`, `MED_PRIORITY`, `LOW_PRIORITY`
+ // and `WAIT_COMPLETE`.
+ virtual void Exec(TIntrusivePtr<ILocallyExecutable> exec, int id, int flags) override;
+
+ // Add tasks range for further execution.
+ //
+ // @param exec Task description.
+ // @param firstId, lastId Task arguments [firstId, lastId)
+ // @param flags Same as for `Exec`.
+ virtual void ExecRange(TIntrusivePtr<ILocallyExecutable> exec, int firstId, int lastId, int flags) override;
+
+ // Submit tasks for async run
+ void SubmitAsyncTasks(TLocallyExecutableFunction exec, int firstId, int lastId);
+
+ private:
+ mutable tbb::task_arena TbbArena;
+ tbb::task_group Group;
+ int NumberOfTbbThreads;
+ };
+}
diff --git a/library/cpp/threading/local_executor/ya.make b/library/cpp/threading/local_executor/ya.make
index 7e4ffd2ab5..df210f92bb 100644
--- a/library/cpp/threading/local_executor/ya.make
+++ b/library/cpp/threading/local_executor/ya.make
@@ -9,7 +9,7 @@ LIBRARY()
SRCS(
local_executor.cpp
- tbb_local_executor.cpp
+ tbb_local_executor.cpp
)
PEERDIR(