diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-10 16:48:02 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:02 +0300 |
commit | 659131349be7796c633c453b4d8b4fa20b8c6ee9 (patch) | |
tree | 67ae2197ea6054b7c46901db060a27fa94377631 /library/cpp/threading/local_executor/tbb_local_executor.h | |
parent | a8b9b8cf5b7405ae170a24f8e1fc27efd8b0849b (diff) | |
download | ydb-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.h')
-rw-r--r-- | library/cpp/threading/local_executor/tbb_local_executor.h | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/library/cpp/threading/local_executor/tbb_local_executor.h b/library/cpp/threading/local_executor/tbb_local_executor.h index 8d790db18c..f62694d6f7 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; + }; +} |