aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/local_executor/local_executor.cpp
diff options
context:
space:
mode:
authorStanislav Kirillov <staskirillov@gmail.com>2022-02-10 16:46:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:07 +0300
commit92fe2b1e7bc79f7b95adef61714fc003f6ea4a1c (patch)
tree817034f4ca57c9f841bb047ec94630c2e78a2b1d /library/cpp/threading/local_executor/local_executor.cpp
parent53c76da6d9f6cc5a17f6029df396f0e3bc1ff47d (diff)
downloadydb-92fe2b1e7bc79f7b95adef61714fc003f6ea4a1c.tar.gz
Restoring authorship annotation for Stanislav Kirillov <staskirillov@gmail.com>. 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.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/library/cpp/threading/local_executor/local_executor.cpp b/library/cpp/threading/local_executor/local_executor.cpp
index 1d3fbb4bf4..d19b48d0b1 100644
--- a/library/cpp/threading/local_executor/local_executor.cpp
+++ b/library/cpp/threading/local_executor/local_executor.cpp
@@ -13,12 +13,12 @@
#include <utility>
#ifdef _win_
-static void RegularYield() {
+static void RegularYield() {
}
#else
// unix actually has cooperative multitasking! :)
// without this function program runs slower and system lags for some magic reason
-static void RegularYield() {
+static void RegularYield() {
SchedYield();
}
#endif
@@ -28,12 +28,12 @@ namespace {
NPar::TLocallyExecutableFunction Exec;
TFunctionWrapper(NPar::TLocallyExecutableFunction exec)
: Exec(std::move(exec))
- {
- }
- void LocalExec(int id) override {
- Exec(id);
- }
- };
+ {
+ }
+ void LocalExec(int id) override {
+ Exec(id);
+ }
+ };
class TFunctionWrapperWithPromise: public NPar::ILocallyExecutable {
private:
@@ -73,7 +73,7 @@ namespace {
struct TSingleJob {
TIntrusivePtr<NPar::ILocallyExecutable> Exec;
int Id{0};
-
+
TSingleJob() = default;
TSingleJob(TIntrusivePtr<NPar::ILocallyExecutable> exec, int id)
: Exec(std::move(exec))
@@ -95,7 +95,7 @@ namespace {
break;
}
AtomicAdd(WorkerCount, -1);
- }
+ }
public:
TLocalRangeExecutor(TIntrusivePtr<ILocallyExecutable> exec, int firstId, int lastId)
@@ -104,7 +104,7 @@ namespace {
, WorkerCount(0)
, LastId(lastId)
{
- }
+ }
bool DoSingleOp() {
const int id = AtomicAdd(Counter, 1) - 1;
if (id >= LastId)
@@ -112,14 +112,14 @@ namespace {
Exec->LocalExec(id);
RegularYield();
return true;
- }
+ }
void WaitComplete() {
while (AtomicGet(WorkerCount) > 0)
RegularYield();
}
int GetRangeSize() const {
return Max<int>(LastId - Counter, 0);
- }
+ }
};
}