aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/local_executor
diff options
context:
space:
mode:
authorVasily Ershov <vasilij.ershov@gmail.com>2022-02-10 16:47:00 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:00 +0300
commit518d03d60d7fc444f0f4f8419fed676376573b42 (patch)
treeb83306b6e37edeea782e9eed673d89286c4fef35 /library/cpp/threading/local_executor
parent057228894caf824ce9d5b05681106304d90aa800 (diff)
downloadydb-518d03d60d7fc444f0f4f8419fed676376573b42.tar.gz
Restoring authorship annotation for Vasily Ershov <vasilij.ershov@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/threading/local_executor')
-rw-r--r--library/cpp/threading/local_executor/local_executor.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/library/cpp/threading/local_executor/local_executor.h b/library/cpp/threading/local_executor/local_executor.h
index 8376a3cc95..c1c824f67c 100644
--- a/library/cpp/threading/local_executor/local_executor.h
+++ b/library/cpp/threading/local_executor/local_executor.h
@@ -149,8 +149,8 @@ namespace NPar {
template <typename TBody>
inline void ExecRange(TBody&& body, TExecRangeParams params, int flags) {
if (TryExecRangeSequentially(body, params.FirstId, params.LastId, flags)) {
- return;
- }
+ return;
+ }
if (params.GetBlockEqualToThreads()) {
params.SetBlockCount(GetThreadCount() + ((flags & WAIT_COMPLETE) != 0)); // ThreadCount or ThreadCount+1 depending on WaitFlag
}
@@ -272,23 +272,23 @@ namespace NPar {
static inline TLocalExecutor& LocalExecutor() {
return *Singleton<TLocalExecutor>();
}
-
- template <typename TBody>
+
+ template <typename TBody>
inline void ParallelFor(ILocalExecutor& executor, ui32 from, ui32 to, TBody&& body) {
ILocalExecutor::TExecRangeParams params(from, to);
- params.SetBlockCountToThreadCount();
+ params.SetBlockCountToThreadCount();
executor.ExecRange(std::forward<TBody>(body), params, TLocalExecutor::WAIT_COMPLETE);
- }
-
- template <typename TBody>
- inline void ParallelFor(ui32 from, ui32 to, TBody&& body) {
- ParallelFor(LocalExecutor(), from, to, std::forward<TBody>(body));
- }
-
- template <typename TBody>
- inline void AsyncParallelFor(ui32 from, ui32 to, TBody&& body) {
+ }
+
+ template <typename TBody>
+ inline void ParallelFor(ui32 from, ui32 to, TBody&& body) {
+ ParallelFor(LocalExecutor(), from, to, std::forward<TBody>(body));
+ }
+
+ template <typename TBody>
+ inline void AsyncParallelFor(ui32 from, ui32 to, TBody&& body) {
ILocalExecutor::TExecRangeParams params(from, to);
- params.SetBlockCountToThreadCount();
+ params.SetBlockCountToThreadCount();
LocalExecutor().ExecRange(std::forward<TBody>(body), params, 0);
- }
+ }
}