aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/coroutine/engine
diff options
context:
space:
mode:
authorkhlebnikov <khlebnikov@yandex-team.ru>2022-02-10 16:50:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:08 +0300
commitdf35d89845ad252e6db1c6adf84da9b15de0e3b3 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/coroutine/engine
parent6cffcf9a14a1dd07278bd534c7cca706ec2827b3 (diff)
downloadydb-df35d89845ad252e6db1c6adf84da9b15de0e3b3.tar.gz
Restoring authorship annotation for <khlebnikov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine')
-rw-r--r--library/cpp/coroutine/engine/cont_poller.cpp2
-rw-r--r--library/cpp/coroutine/engine/impl.cpp50
-rw-r--r--library/cpp/coroutine/engine/impl.h4
-rw-r--r--library/cpp/coroutine/engine/network.cpp2
4 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/coroutine/engine/cont_poller.cpp b/library/cpp/coroutine/engine/cont_poller.cpp
index d0fea23e97..76593d4e9b 100644
--- a/library/cpp/coroutine/engine/cont_poller.cpp
+++ b/library/cpp/coroutine/engine/cont_poller.cpp
@@ -12,7 +12,7 @@ namespace NCoro {
}
cont->Executor()->ScheduleIoWait(event);
- cont->Switch();
+ cont->Switch();
if (cont->Cancelled()) {
return ECANCELED;
diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp
index a75923e606..7ae6f74051 100644
--- a/library/cpp/coroutine/engine/impl.cpp
+++ b/library/cpp/coroutine/engine/impl.cpp
@@ -51,7 +51,7 @@ bool TCont::Join(TCont* c, TInstant deadLine) noexcept {
c->Cancel();
do {
- Switch();
+ Switch();
} while (!ev.Empty());
}
@@ -68,10 +68,10 @@ int TCont::SleepD(TInstant deadline) noexcept {
return ExecuteEvent(&event);
}
-void TCont::Switch() noexcept {
- Executor()->RunScheduler();
-}
-
+void TCont::Switch() noexcept {
+ Executor()->RunScheduler();
+}
+
void TCont::Yield() noexcept {
if (SleepD(TInstant::Zero())) {
ReScheduleAndSwitch();
@@ -80,7 +80,7 @@ void TCont::Yield() noexcept {
void TCont::ReScheduleAndSwitch() noexcept {
ReSchedule();
- Switch();
+ Switch();
}
void TCont::Terminate() {
@@ -300,8 +300,8 @@ void TContExecutor::RunScheduler() noexcept {
try {
TContExecutor* const prev = ThisThreadExecutor();
ThisThreadExecutor() = this;
- TCont* caller = Current_;
- TExceptionSafeContext* context = caller ? caller->Trampoline_.Context() : &SchedContext_;
+ TCont* caller = Current_;
+ TExceptionSafeContext* context = caller ? caller->Trampoline_.Context() : &SchedContext_;
Y_DEFER {
ThisThreadExecutor() = prev;
};
@@ -309,17 +309,17 @@ void TContExecutor::RunScheduler() noexcept {
while (true) {
if (ScheduleCallback_ && Current_) {
ScheduleCallback_->OnUnschedule(*this);
- }
-
- WaitForIO();
- DeleteScheduled();
+ }
+
+ WaitForIO();
+ DeleteScheduled();
Ready_.Append(ReadyNext_);
if (Ready_.Empty()) {
- Current_ = nullptr;
- if (caller) {
- context->SwitchTo(&SchedContext_);
- }
+ Current_ = nullptr;
+ if (caller) {
+ context->SwitchTo(&SchedContext_);
+ }
break;
}
@@ -328,21 +328,21 @@ void TContExecutor::RunScheduler() noexcept {
if (ScheduleCallback_) {
ScheduleCallback_->OnSchedule(*this, *cont);
}
-
- Current_ = cont;
- cont->Scheduled_ = false;
- if (cont == caller) {
- break;
+
+ Current_ = cont;
+ cont->Scheduled_ = false;
+ if (cont == caller) {
+ break;
}
- context->SwitchTo(cont->Trampoline_.Context());
+ context->SwitchTo(cont->Trampoline_.Context());
if (Paused_) {
Paused_ = false;
Current_ = nullptr;
break;
}
- if (caller) {
- break;
- }
+ if (caller) {
+ break;
+ }
}
} catch (...) {
TBackTrace::FromCurrentException().PrintTo(Cerr);
diff --git a/library/cpp/coroutine/engine/impl.h b/library/cpp/coroutine/engine/impl.h
index b07f8aafbf..283a96ecf1 100644
--- a/library/cpp/coroutine/engine/impl.h
+++ b/library/cpp/coroutine/engine/impl.h
@@ -99,8 +99,8 @@ public:
void ReSchedule() noexcept;
- void Switch() noexcept;
-
+ void Switch() noexcept;
+
void SwitchTo(TExceptionSafeContext* ctx) {
Trampoline_.SwitchTo(ctx);
}
diff --git a/library/cpp/coroutine/engine/network.cpp b/library/cpp/coroutine/engine/network.cpp
index 389c1ea298..85b647d210 100644
--- a/library/cpp/coroutine/engine/network.cpp
+++ b/library/cpp/coroutine/engine/network.cpp
@@ -51,7 +51,7 @@ namespace NCoro {
for (auto i : xrange(nfds)) {
cont->Executor()->ScheduleIoWait(events.Data() + i);
}
- cont->Switch();
+ cont->Switch();
if (cont->Cancelled()) {
return ECANCELED;