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
commit057228894caf824ce9d5b05681106304d90aa800 (patch)
tree97c6a02523ad9f2c8e211feffa448debdf1433c3 /library/cpp/threading/local_executor
parent6421a2a7919e21e661ad672f2b9e57c5194b8487 (diff)
downloadydb-057228894caf824ce9d5b05681106304d90aa800.tar.gz
Restoring authorship annotation for Vasily Ershov <vasilij.ershov@gmail.com>. Commit 1 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 c1c824f67c..8376a3cc95 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);
- }
+ }
}