aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/local_executor/tbb_local_executor.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
commit659131349be7796c633c453b4d8b4fa20b8c6ee9 (patch)
tree67ae2197ea6054b7c46901db060a27fa94377631 /library/cpp/threading/local_executor/tbb_local_executor.cpp
parenta8b9b8cf5b7405ae170a24f8e1fc27efd8b0849b (diff)
downloadydb-659131349be7796c633c453b4d8b4fa20b8c6ee9.tar.gz
Restoring authorship annotation for <arcadia-devtools@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/threading/local_executor/tbb_local_executor.cpp')
-rw-r--r--library/cpp/threading/local_executor/tbb_local_executor.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/library/cpp/threading/local_executor/tbb_local_executor.cpp b/library/cpp/threading/local_executor/tbb_local_executor.cpp
index 65d6659443..9903ef33de 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>;