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:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:08 +0300
commitcb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/threading/local_executor/local_executor.cpp
parent92fe2b1e7bc79f7b95adef61714fc003f6ea4a1c (diff)
downloadydb-cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134.tar.gz
Restoring authorship annotation for Stanislav Kirillov <staskirillov@gmail.com>. Commit 2 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 d19b48d0b1..1d3fbb4bf4 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);
- }
+ }
};
}