diff options
author | gulin <gulin@yandex-team.ru> | 2022-02-10 16:47:31 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:31 +0300 |
commit | c807aae441c17fc7f577c35757a4b6e0bd909802 (patch) | |
tree | fc3268f43edbf6f854c0266cd05b91952484179b /library/cpp/threading/local_executor/local_executor.cpp | |
parent | d06e6190fa85c1fb4b011631503d53ea39942ff9 (diff) | |
download | ydb-c807aae441c17fc7f577c35757a4b6e0bd909802.tar.gz |
Restoring authorship annotation for <gulin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/threading/local_executor/local_executor.cpp')
-rw-r--r-- | library/cpp/threading/local_executor/local_executor.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/library/cpp/threading/local_executor/local_executor.cpp b/library/cpp/threading/local_executor/local_executor.cpp index 1d3fbb4bf4..271e763498 100644 --- a/library/cpp/threading/local_executor/local_executor.cpp +++ b/library/cpp/threading/local_executor/local_executor.cpp @@ -5,24 +5,24 @@ #include <util/generic/utility.h> #include <util/system/atomic.h> #include <util/system/event.h> -#include <util/system/thread.h> +#include <util/system/thread.h> #include <util/system/tls.h> -#include <util/system/yield.h> +#include <util/system/yield.h> #include <util/thread/lfqueue.h> - + #include <utility> -#ifdef _win_ +#ifdef _win_ static void RegularYield() { -} -#else -// unix actually has cooperative multitasking! :) -// without this function program runs slower and system lags for some magic reason +} +#else +// unix actually has cooperative multitasking! :) +// without this function program runs slower and system lags for some magic reason static void RegularYield() { - SchedYield(); -} -#endif - + SchedYield(); +} +#endif + namespace { struct TFunctionWrapper : NPar::ILocallyExecutable { NPar::TLocallyExecutableFunction Exec; @@ -79,15 +79,15 @@ namespace { : Exec(std::move(exec)) , Id(id) { - } + } }; - + class TLocalRangeExecutor: public NPar::ILocallyExecutable { TIntrusivePtr<NPar::ILocallyExecutable> Exec; alignas(64) TAtomic Counter; alignas(64) TAtomic WorkerCount; int LastId; - + void LocalExec(int) override { AtomicAdd(WorkerCount, 1); for (;;) { @@ -96,7 +96,7 @@ namespace { } AtomicAdd(WorkerCount, -1); } - + public: TLocalRangeExecutor(TIntrusivePtr<ILocallyExecutable> exec, int firstId, int lastId) : Exec(std::move(exec)) @@ -121,8 +121,8 @@ namespace { return Max<int>(LastId - Counter, 0); } }; - -} + +} ////////////////////////////////////////////////////////////////////////// class NPar::TLocalExecutor::TImpl { |