aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/coroutine/engine
diff options
context:
space:
mode:
authorArseny Smalyuk <smalukav@gmail.com>2022-02-10 16:48:05 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:05 +0300
commit12559cd7f2fa0cf54ffb0d961949fea58c0e18cb (patch)
tree1c6e1bb383ce1ed8ea168386f913410dd55ccb7f /library/cpp/coroutine/engine
parent5b8d95df2f0cfca4d3f5499a4259aa2050ef1571 (diff)
downloadydb-12559cd7f2fa0cf54ffb0d961949fea58c0e18cb.tar.gz
Restoring authorship annotation for Arseny Smalyuk <smalukav@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine')
-rw-r--r--library/cpp/coroutine/engine/callbacks.h14
-rw-r--r--library/cpp/coroutine/engine/coroutine_ut.cpp6
-rw-r--r--library/cpp/coroutine/engine/impl.cpp58
-rw-r--r--library/cpp/coroutine/engine/impl.h10
-rw-r--r--library/cpp/coroutine/engine/network.cpp2
-rw-r--r--library/cpp/coroutine/engine/poller.cpp34
6 files changed, 62 insertions, 62 deletions
diff --git a/library/cpp/coroutine/engine/callbacks.h b/library/cpp/coroutine/engine/callbacks.h
index e81b17344f..e578ae2b35 100644
--- a/library/cpp/coroutine/engine/callbacks.h
+++ b/library/cpp/coroutine/engine/callbacks.h
@@ -6,13 +6,13 @@ class TContExecutor;
namespace NCoro {
class IScheduleCallback {
public:
- virtual void OnSchedule(TContExecutor&, TCont&) = 0;
- virtual void OnUnschedule(TContExecutor&) = 0;
- };
+ virtual void OnSchedule(TContExecutor&, TCont&) = 0;
+ virtual void OnUnschedule(TContExecutor&) = 0;
+ };
- class IEnterPollerCallback {
- public:
- virtual void OnEnterPoller() = 0;
- virtual void OnExitPoller() = 0;
+ class IEnterPollerCallback {
+ public:
+ virtual void OnEnterPoller() = 0;
+ virtual void OnExitPoller() = 0;
};
}
diff --git a/library/cpp/coroutine/engine/coroutine_ut.cpp b/library/cpp/coroutine/engine/coroutine_ut.cpp
index 8b372496a2..8daec28f14 100644
--- a/library/cpp/coroutine/engine/coroutine_ut.cpp
+++ b/library/cpp/coroutine/engine/coroutine_ut.cpp
@@ -36,7 +36,7 @@ class TCoroTest: public TTestBase {
// UNIT_TEST(TestFastPathWakeEpoll)
UNIT_TEST(TestFastPathWakeKqueue)
UNIT_TEST(TestFastPathWakePoll)
- UNIT_TEST(TestFastPathWakeSelect)
+ UNIT_TEST(TestFastPathWakeSelect)
UNIT_TEST(TestLegacyCancelYieldRaceBug)
UNIT_TEST(TestJoinRescheduleBug);
UNIT_TEST(TestEventQueue)
@@ -943,7 +943,7 @@ void TCoroTest::TestPollEngines() {
}
void TCoroTest::TestPause() {
- TContExecutor executor{1024*1024, IPollerFace::Default(), nullptr, nullptr, NCoro::NStack::EGuard::Canary, Nothing()};
+ TContExecutor executor{1024*1024, IPollerFace::Default(), nullptr, nullptr, NCoro::NStack::EGuard::Canary, Nothing()};
int i = 0;
executor.CreateOwned([&](TCont*) {
@@ -993,7 +993,7 @@ void TCoroTest::TestOverrideTime() {
};
TTime time;
- TContExecutor executor{1024*1024, IPollerFace::Default(), nullptr, nullptr, NCoro::NStack::EGuard::Canary, Nothing(), &time};
+ TContExecutor executor{1024*1024, IPollerFace::Default(), nullptr, nullptr, NCoro::NStack::EGuard::Canary, Nothing(), &time};
executor.CreateOwned([&](TCont* cont) {
UNIT_ASSERT_EQUAL(cont->Executor()->Now(), TInstant::Zero());
diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp
index 7ae6f74051..578d06498b 100644
--- a/library/cpp/coroutine/engine/impl.cpp
+++ b/library/cpp/coroutine/engine/impl.cpp
@@ -119,14 +119,14 @@ void TCont::ReSchedule() noexcept {
TContExecutor::TContExecutor(
uint32_t defaultStackSize,
THolder<IPollerFace> poller,
- NCoro::IScheduleCallback* scheduleCallback,
- NCoro::IEnterPollerCallback* enterPollerCallback,
+ NCoro::IScheduleCallback* scheduleCallback,
+ NCoro::IEnterPollerCallback* enterPollerCallback,
NCoro::NStack::EGuard defaultGuard,
TMaybe<NCoro::NStack::TPoolAllocatorSettings> poolSettings,
NCoro::ITime* time
)
- : ScheduleCallback_(scheduleCallback)
- , EnterPollerCallback_(enterPollerCallback)
+ : ScheduleCallback_(scheduleCallback)
+ , EnterPollerCallback_(enterPollerCallback)
, DefaultStackSize_(defaultStackSize)
, Poller_(std::move(poller))
, Time_(time)
@@ -171,21 +171,21 @@ void TContExecutor::WaitForIO() {
// to prevent ourselves from locking out of io by constantly waking coroutines.
if (ReadyNext_.Empty()) {
- if (EnterPollerCallback_) {
- EnterPollerCallback_->OnEnterPoller();
- }
+ if (EnterPollerCallback_) {
+ EnterPollerCallback_->OnEnterPoller();
+ }
Poll(next);
- if (EnterPollerCallback_) {
- EnterPollerCallback_->OnExitPoller();
- }
+ if (EnterPollerCallback_) {
+ EnterPollerCallback_->OnExitPoller();
+ }
} else if (LastPoll_ + TDuration::MilliSeconds(5) < now) {
- if (EnterPollerCallback_) {
- EnterPollerCallback_->OnEnterPoller();
- }
+ if (EnterPollerCallback_) {
+ EnterPollerCallback_->OnEnterPoller();
+ }
Poll(now);
- if (EnterPollerCallback_) {
- EnterPollerCallback_->OnExitPoller();
- }
+ if (EnterPollerCallback_) {
+ EnterPollerCallback_->OnExitPoller();
+ }
}
Ready_.Append(ReadyNext_);
@@ -296,8 +296,8 @@ TCont* RunningCont() {
return thisThreadExecutor ? thisThreadExecutor->Running() : nullptr;
}
-void TContExecutor::RunScheduler() noexcept {
- try {
+void TContExecutor::RunScheduler() noexcept {
+ try {
TContExecutor* const prev = ThisThreadExecutor();
ThisThreadExecutor() = this;
TCont* caller = Current_;
@@ -306,27 +306,27 @@ void TContExecutor::RunScheduler() noexcept {
ThisThreadExecutor() = prev;
};
- while (true) {
- if (ScheduleCallback_ && Current_) {
- ScheduleCallback_->OnUnschedule(*this);
+ while (true) {
+ if (ScheduleCallback_ && Current_) {
+ ScheduleCallback_->OnUnschedule(*this);
}
WaitForIO();
DeleteScheduled();
- Ready_.Append(ReadyNext_);
+ Ready_.Append(ReadyNext_);
- if (Ready_.Empty()) {
+ if (Ready_.Empty()) {
Current_ = nullptr;
if (caller) {
context->SwitchTo(&SchedContext_);
}
- break;
- }
+ break;
+ }
TCont* cont = Ready_.PopFront();
- if (ScheduleCallback_) {
- ScheduleCallback_->OnSchedule(*this, *cont);
+ if (ScheduleCallback_) {
+ ScheduleCallback_->OnSchedule(*this, *cont);
}
Current_ = cont;
@@ -343,8 +343,8 @@ void TContExecutor::RunScheduler() noexcept {
if (caller) {
break;
}
- }
- } catch (...) {
+ }
+ } catch (...) {
TBackTrace::FromCurrentException().PrintTo(Cerr);
Y_FAIL("Uncaught exception in the scheduler: %s", CurrentExceptionMessage().c_str());
}
diff --git a/library/cpp/coroutine/engine/impl.h b/library/cpp/coroutine/engine/impl.h
index 283a96ecf1..0b892749a0 100644
--- a/library/cpp/coroutine/engine/impl.h
+++ b/library/cpp/coroutine/engine/impl.h
@@ -1,6 +1,6 @@
#pragma once
-#include "callbacks.h"
+#include "callbacks.h"
#include "cont_poller.h"
#include "iostatus.h"
#include "poller.h"
@@ -154,7 +154,7 @@ public:
uint32_t defaultStackSize,
THolder<IPollerFace> poller = IPollerFace::Default(),
NCoro::IScheduleCallback* = nullptr,
- NCoro::IEnterPollerCallback* = nullptr,
+ NCoro::IEnterPollerCallback* = nullptr,
NCoro::NStack::EGuard stackGuard = NCoro::NStack::EGuard::Canary,
TMaybe<NCoro::NStack::TPoolAllocatorSettings> poolSettings = Nothing(),
NCoro::ITime* time = nullptr
@@ -273,7 +273,7 @@ private:
void Exit(TCont* cont) noexcept;
- void RunScheduler() noexcept;
+ void RunScheduler() noexcept;
void ScheduleToDelete(TCont* cont) noexcept;
@@ -288,8 +288,8 @@ private:
void Poll(TInstant deadline);
private:
- NCoro::IScheduleCallback* const ScheduleCallback_ = nullptr;
- NCoro::IEnterPollerCallback* const EnterPollerCallback_ = nullptr;
+ NCoro::IScheduleCallback* const ScheduleCallback_ = nullptr;
+ NCoro::IEnterPollerCallback* const EnterPollerCallback_ = nullptr;
const uint32_t DefaultStackSize_;
THolder<NCoro::NStack::IAllocator> StackAllocator_;
diff --git a/library/cpp/coroutine/engine/network.cpp b/library/cpp/coroutine/engine/network.cpp
index 85b647d210..6315532d3f 100644
--- a/library/cpp/coroutine/engine/network.cpp
+++ b/library/cpp/coroutine/engine/network.cpp
@@ -295,7 +295,7 @@ namespace NCoro {
if (!IsBlocked(err)) {
return -err;
- }
+ }
err = PollD(cont, s, CONT_POLL_READ, deadline);
diff --git a/library/cpp/coroutine/engine/poller.cpp b/library/cpp/coroutine/engine/poller.cpp
index 61164fa56b..8aeff4e965 100644
--- a/library/cpp/coroutine/engine/poller.cpp
+++ b/library/cpp/coroutine/engine/poller.cpp
@@ -88,8 +88,8 @@ namespace {
void Wait(TEvents& events, TInstant deadLine) {
const size_t ret = P_.WaitD(~E_, +E_, deadLine);
- events.reserve(ret);
-
+ events.reserve(ret);
+
for (size_t i = 0; i < ret; ++i) {
const TInternalEvent* ie = ~E_ + i;
@@ -199,12 +199,12 @@ namespace {
ret |= POLLOUT;
}
-#if defined(_linux_)
- if (flags & CONT_POLL_RDHUP) {
- ret |= POLLRDHUP;
- }
-#endif
-
+#if defined(_linux_)
+ if (flags & CONT_POLL_RDHUP) {
+ ret |= POLLRDHUP;
+ }
+#endif
+
return ret;
}
@@ -248,12 +248,12 @@ namespace {
const ssize_t ret = PollD(T_.data(), (nfds_t) T_.size(), deadLine);
- if (ret <= 0) {
+ if (ret <= 0) {
return;
}
events.reserve(T_.size());
-
+
for (size_t i = 0; i < T_.size(); ++i) {
const pollfd& pfd = T_[i];
const short ev = pfd.revents;
@@ -274,12 +274,12 @@ namespace {
filter |= CONT_POLL_WRITE;
}
-#if defined(_linux_)
- if (ev & POLLRDHUP) {
- filter |= CONT_POLL_RDHUP;
- }
-#endif
-
+#if defined(_linux_)
+ if (ev & POLLRDHUP) {
+ filter |= CONT_POLL_RDHUP;
+ }
+#endif
+
if (ev & POLLERR) {
status = EIO;
} else if (ev & POLLHUP && pfd.events & POLLOUT) {
@@ -290,7 +290,7 @@ namespace {
}
if (status) {
- filter = CONT_POLL_READ | CONT_POLL_WRITE | CONT_POLL_RDHUP;
+ filter = CONT_POLL_READ | CONT_POLL_WRITE | CONT_POLL_RDHUP;
}
const TEvent res = {