aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/coroutine/engine
diff options
context:
space:
mode:
authorkulikov <kulikov@yandex-team.ru>2022-02-10 16:49:34 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:34 +0300
commit65e5266709e7ff94b14ae128309e229de714b0df (patch)
treed4901f06e56d95f5e5d36bd1806bcc144d03bf41 /library/cpp/coroutine/engine
parent0041d99876ae3dccc3f0fa8787131d85ddfd486b (diff)
downloadydb-65e5266709e7ff94b14ae128309e229de714b0df.tar.gz
Restoring authorship annotation for <kulikov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine')
-rw-r--r--library/cpp/coroutine/engine/cont_poller.h26
-rw-r--r--library/cpp/coroutine/engine/coroutine_ut.cpp292
-rw-r--r--library/cpp/coroutine/engine/impl.cpp70
-rw-r--r--library/cpp/coroutine/engine/impl.h50
-rw-r--r--library/cpp/coroutine/engine/poller.cpp30
-rw-r--r--library/cpp/coroutine/engine/poller.h4
-rw-r--r--library/cpp/coroutine/engine/sockpool.h8
-rw-r--r--library/cpp/coroutine/engine/trampoline.cpp6
-rw-r--r--library/cpp/coroutine/engine/trampoline.h8
9 files changed, 247 insertions, 247 deletions
diff --git a/library/cpp/coroutine/engine/cont_poller.h b/library/cpp/coroutine/engine/cont_poller.h
index b638b2df1a..d158bbe9f5 100644
--- a/library/cpp/coroutine/engine/cont_poller.h
+++ b/library/cpp/coroutine/engine/cont_poller.h
@@ -143,13 +143,13 @@ namespace NCoro {
auto* lst = Lists_.Get(event->Fd());
const ui16 oldFlags = Flags(*lst);
lst->PushFront(event);
- ui16 newFlags = Flags(*lst);
+ ui16 newFlags = Flags(*lst);
if (newFlags != oldFlags) {
- if (oldFlags) {
- newFlags |= CONT_POLL_MODIFY;
- }
-
+ if (oldFlags) {
+ newFlags |= CONT_POLL_MODIFY;
+ }
+
P_->Set(lst, event->Fd(), newFlags);
}
}
@@ -158,13 +158,13 @@ namespace NCoro {
auto* lst = Lists_.Get(event->Fd());
const ui16 oldFlags = Flags(*lst);
event->Unlink();
- ui16 newFlags = Flags(*lst);
+ ui16 newFlags = Flags(*lst);
if (newFlags != oldFlags) {
- if (newFlags) {
- newFlags |= CONT_POLL_MODIFY;
- }
-
+ if (newFlags) {
+ newFlags |= CONT_POLL_MODIFY;
+ }
+
P_->Set(lst, event->Fd(), newFlags);
}
}
@@ -174,9 +174,9 @@ namespace NCoro {
P_->Wait(events, deadLine);
}
- EContPoller PollEngine() const {
- return P_->PollEngine();
- }
+ EContPoller PollEngine() const {
+ return P_->PollEngine();
+ }
private:
static ui16 Flags(TIntrusiveList<IPollEvent>& lst) noexcept {
ui16 ret = 0;
diff --git a/library/cpp/coroutine/engine/coroutine_ut.cpp b/library/cpp/coroutine/engine/coroutine_ut.cpp
index 8b372496a2..a7012eb8e2 100644
--- a/library/cpp/coroutine/engine/coroutine_ut.cpp
+++ b/library/cpp/coroutine/engine/coroutine_ut.cpp
@@ -8,16 +8,16 @@
#include <util/system/pipe.h>
#include <util/system/env.h>
#include <util/system/info.h>
-#include <util/system/thread.h>
+#include <util/system/thread.h>
#include <util/generic/xrange.h>
-#include <util/generic/serialized_enum.h>
+#include <util/generic/serialized_enum.h>
// TODO (velavokr): BALANCER-1345 add more tests on pollers
class TCoroTest: public TTestBase {
UNIT_TEST_SUITE(TCoroTest);
UNIT_TEST(TestSimpleX1);
- UNIT_TEST(TestSimpleX1MultiThread);
+ UNIT_TEST(TestSimpleX1MultiThread);
UNIT_TEST(TestSimpleX2);
UNIT_TEST(TestSimpleX3);
UNIT_TEST(TestMemFun);
@@ -40,10 +40,10 @@ class TCoroTest: public TTestBase {
UNIT_TEST(TestLegacyCancelYieldRaceBug)
UNIT_TEST(TestJoinRescheduleBug);
UNIT_TEST(TestEventQueue)
- UNIT_TEST(TestNestedExecutor)
- UNIT_TEST(TestComputeCoroutineYield)
- UNIT_TEST(TestPollEngines);
- UNIT_TEST(TestUserEvent);
+ UNIT_TEST(TestNestedExecutor)
+ UNIT_TEST(TestComputeCoroutineYield)
+ UNIT_TEST(TestPollEngines);
+ UNIT_TEST(TestUserEvent);
UNIT_TEST(TestPause);
UNIT_TEST(TestOverrideTime);
UNIT_TEST_SUITE_END();
@@ -51,7 +51,7 @@ class TCoroTest: public TTestBase {
public:
void TestException();
void TestSimpleX1();
- void TestSimpleX1MultiThread();
+ void TestSimpleX1MultiThread();
void TestSimpleX2();
void TestSimpleX3();
void TestMemFun();
@@ -72,10 +72,10 @@ public:
void TestLegacyCancelYieldRaceBug();
void TestJoinRescheduleBug();
void TestEventQueue();
- void TestNestedExecutor();
- void TestComputeCoroutineYield();
- void TestPollEngines();
- void TestUserEvent();
+ void TestNestedExecutor();
+ void TestComputeCoroutineYield();
+ void TestPollEngines();
+ void TestUserEvent();
void TestPause();
void TestOverrideTime();
};
@@ -130,54 +130,54 @@ static int i0;
static void CoRun(TCont* c, void* /*run*/) {
while (i0 < 100000) {
++i0;
- UNIT_ASSERT(RunningCont() == c);
+ UNIT_ASSERT(RunningCont() == c);
c->Yield();
- UNIT_ASSERT(RunningCont() == c);
+ UNIT_ASSERT(RunningCont() == c);
}
}
static void CoMain(TCont* c, void* /*arg*/) {
for (volatile size_t i2 = 0; i2 < 10; ++i2) {
- UNIT_ASSERT(RunningCont() == c);
+ UNIT_ASSERT(RunningCont() == c);
c->Executor()->Create(CoRun, nullptr, "run");
- UNIT_ASSERT(RunningCont() == c);
+ UNIT_ASSERT(RunningCont() == c);
}
}
void TCoroTest::TestSimpleX1() {
i0 = 0;
TContExecutor e(32000);
-
- UNIT_ASSERT(RunningCont() == nullptr);
-
+
+ UNIT_ASSERT(RunningCont() == nullptr);
+
e.Execute(CoMain);
UNIT_ASSERT_VALUES_EQUAL(i0, 100000);
-
- UNIT_ASSERT(RunningCont() == nullptr);
-}
-
-void TCoroTest::TestSimpleX1MultiThread() {
- TVector<THolder<TThread>> threads;
- const size_t nThreads = 0;
- TAtomic c = 0;
- for (size_t i = 0; i < nThreads; ++i) {
- threads.push_back(MakeHolder<TThread>([&]() {
- TestSimpleX1();
- AtomicIncrement(c);
- }));
- }
-
- for (auto& t : threads) {
- t->Start();
- }
-
- for (auto& t: threads) {
- t->Join();
- }
-
- UNIT_ASSERT_EQUAL(c, nThreads);
-}
-
+
+ UNIT_ASSERT(RunningCont() == nullptr);
+}
+
+void TCoroTest::TestSimpleX1MultiThread() {
+ TVector<THolder<TThread>> threads;
+ const size_t nThreads = 0;
+ TAtomic c = 0;
+ for (size_t i = 0; i < nThreads; ++i) {
+ threads.push_back(MakeHolder<TThread>([&]() {
+ TestSimpleX1();
+ AtomicIncrement(c);
+ }));
+ }
+
+ for (auto& t : threads) {
+ t->Start();
+ }
+
+ for (auto& t: threads) {
+ t->Join();
+ }
+
+ UNIT_ASSERT_EQUAL(c, nThreads);
+}
+
struct TTestObject {
int i = 0;
int j = 0;
@@ -863,85 +863,85 @@ void TCoroTest::TestEventQueue() {
}, &queue);
}
-void TCoroTest::TestNestedExecutor() {
-#ifndef _win_
- //nested executors actually don't work correctly, but anyway shouldn't break RunningCont() ptr
- TContExecutor exec(32000);
- UNIT_ASSERT(!RunningCont());
-
- exec.Execute([](TCont* cont, void*) {
- UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont);
-
- TContExecutor exec2(32000);
- exec2.Execute([](TCont* cont2, void*) {
- UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont2);
- TContExecutor exec3(32000);
- exec3.Execute([](TCont* cont3, void*) {
- UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont3);
- });
-
- UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont2);
- });
-
- UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont);
- });
-
- UNIT_ASSERT(!RunningCont());
-#endif
-}
-
-void TCoroTest::TestComputeCoroutineYield() {
-//if we have busy (e.g., on cpu) coroutine, when it yields, io must flow
- TContExecutor exec(32000);
- exec.SetFailOnError(true);
-
- TPipe in, out;
- TPipe::Pipe(in, out);
- SetNonBlock(in.GetHandle());
- size_t lastRead = 42;
-
- auto compute = [&](TCont* cont) {
- for (size_t i = 0; i < 10; ++i) {
- write(out.GetHandle(), &i, sizeof i);
- Sleep(TDuration::MilliSeconds(10));
- cont->Yield();
- UNIT_ASSERT(lastRead == i);
- }
- };
-
- auto io = [&](TCont* cont) {
- for (size_t i = 0; i < 10; ++i) {
- NCoro::ReadI(cont, in.GetHandle(), &lastRead, sizeof lastRead);
- }
- };
-
- exec.Create(compute, "compute");
- exec.Create(io, "io");
-
- exec.Execute();
-}
-
-void TCoroTest::TestPollEngines() {
- bool defaultChecked = false;
- for (auto engine : GetEnumAllValues<EContPoller>()) {
- auto poller = IPollerFace::Construct(engine);
- if (!poller) {
- continue;
- }
-
- TContExecutor exec(32000, IPollerFace::Construct(engine));
-
- if (engine == EContPoller::Default) {
- defaultChecked = true;
- UNIT_ASSERT_VALUES_EQUAL(exec.Poller()->PollEngine(), EContPoller::Combined);
- } else {
- UNIT_ASSERT_VALUES_EQUAL(exec.Poller()->PollEngine(), engine);
- }
- }
-
- UNIT_ASSERT(defaultChecked);
-}
-
+void TCoroTest::TestNestedExecutor() {
+#ifndef _win_
+ //nested executors actually don't work correctly, but anyway shouldn't break RunningCont() ptr
+ TContExecutor exec(32000);
+ UNIT_ASSERT(!RunningCont());
+
+ exec.Execute([](TCont* cont, void*) {
+ UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont);
+
+ TContExecutor exec2(32000);
+ exec2.Execute([](TCont* cont2, void*) {
+ UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont2);
+ TContExecutor exec3(32000);
+ exec3.Execute([](TCont* cont3, void*) {
+ UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont3);
+ });
+
+ UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont2);
+ });
+
+ UNIT_ASSERT_VALUES_EQUAL(RunningCont(), cont);
+ });
+
+ UNIT_ASSERT(!RunningCont());
+#endif
+}
+
+void TCoroTest::TestComputeCoroutineYield() {
+//if we have busy (e.g., on cpu) coroutine, when it yields, io must flow
+ TContExecutor exec(32000);
+ exec.SetFailOnError(true);
+
+ TPipe in, out;
+ TPipe::Pipe(in, out);
+ SetNonBlock(in.GetHandle());
+ size_t lastRead = 42;
+
+ auto compute = [&](TCont* cont) {
+ for (size_t i = 0; i < 10; ++i) {
+ write(out.GetHandle(), &i, sizeof i);
+ Sleep(TDuration::MilliSeconds(10));
+ cont->Yield();
+ UNIT_ASSERT(lastRead == i);
+ }
+ };
+
+ auto io = [&](TCont* cont) {
+ for (size_t i = 0; i < 10; ++i) {
+ NCoro::ReadI(cont, in.GetHandle(), &lastRead, sizeof lastRead);
+ }
+ };
+
+ exec.Create(compute, "compute");
+ exec.Create(io, "io");
+
+ exec.Execute();
+}
+
+void TCoroTest::TestPollEngines() {
+ bool defaultChecked = false;
+ for (auto engine : GetEnumAllValues<EContPoller>()) {
+ auto poller = IPollerFace::Construct(engine);
+ if (!poller) {
+ continue;
+ }
+
+ TContExecutor exec(32000, IPollerFace::Construct(engine));
+
+ if (engine == EContPoller::Default) {
+ defaultChecked = true;
+ UNIT_ASSERT_VALUES_EQUAL(exec.Poller()->PollEngine(), EContPoller::Combined);
+ } else {
+ UNIT_ASSERT_VALUES_EQUAL(exec.Poller()->PollEngine(), engine);
+ }
+ }
+
+ UNIT_ASSERT(defaultChecked);
+}
+
void TCoroTest::TestPause() {
TContExecutor executor{1024*1024, IPollerFace::Default(), nullptr, nullptr, NCoro::NStack::EGuard::Canary, Nothing()};
@@ -959,28 +959,28 @@ void TCoroTest::TestPause() {
UNIT_ASSERT_EQUAL(i, 2);
}
-void TCoroTest::TestUserEvent() {
- TContExecutor exec(32000);
-
- struct TUserEvent : public IUserEvent {
- bool Called = false;
- void Execute() override {
- Called = true;
- }
- } event;
-
- auto f = [&](TCont* cont) {
- UNIT_ASSERT(!event.Called);
- exec.ScheduleUserEvent(&event);
- UNIT_ASSERT(!event.Called);
- cont->Yield();
- UNIT_ASSERT(event.Called);
- };
-
- exec.Execute(f);
-
- UNIT_ASSERT(event.Called);
-}
+void TCoroTest::TestUserEvent() {
+ TContExecutor exec(32000);
+
+ struct TUserEvent : public IUserEvent {
+ bool Called = false;
+ void Execute() override {
+ Called = true;
+ }
+ } event;
+
+ auto f = [&](TCont* cont) {
+ UNIT_ASSERT(!event.Called);
+ exec.ScheduleUserEvent(&event);
+ UNIT_ASSERT(!event.Called);
+ cont->Yield();
+ UNIT_ASSERT(event.Called);
+ };
+
+ exec.Execute(f);
+
+ UNIT_ASSERT(event.Called);
+}
void TCoroTest::TestOverrideTime() {
class TTime: public NCoro::ITime {
diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp
index 7ae6f74051..9231d2b1ba 100644
--- a/library/cpp/coroutine/engine/impl.cpp
+++ b/library/cpp/coroutine/engine/impl.cpp
@@ -3,8 +3,8 @@
#include "stack/stack_allocator.h"
#include "stack/stack_guards.h"
-#include <util/generic/scope.h>
-#include <util/thread/singleton.h>
+#include <util/generic/scope.h>
+#include <util/thread/singleton.h>
#include <util/stream/format.h>
#include <util/stream/output.h>
#include <util/system/yassert.h>
@@ -157,47 +157,47 @@ void TContExecutor::WaitForIO() {
// Waking a coroutine puts it into ReadyNext_ list
const auto next = WaitQueue_.WakeTimedout(now);
- if (!UserEvents_.Empty()) {
- TIntrusiveList<IUserEvent> userEvents;
- userEvents.Swap(UserEvents_);
- do {
- userEvents.PopFront()->Execute();
- } while (!userEvents.Empty());
- }
-
+ if (!UserEvents_.Empty()) {
+ TIntrusiveList<IUserEvent> userEvents;
+ userEvents.Swap(UserEvents_);
+ do {
+ userEvents.PopFront()->Execute();
+ } while (!userEvents.Empty());
+ }
+
// Polling will return as soon as there is an event to process or a timeout.
// If there are woken coroutines we do not want to sleep in the poller
// yet still we want to check for new io
// to prevent ourselves from locking out of io by constantly waking coroutines.
- if (ReadyNext_.Empty()) {
+ if (ReadyNext_.Empty()) {
if (EnterPollerCallback_) {
EnterPollerCallback_->OnEnterPoller();
}
- Poll(next);
+ Poll(next);
if (EnterPollerCallback_) {
EnterPollerCallback_->OnExitPoller();
}
- } else if (LastPoll_ + TDuration::MilliSeconds(5) < now) {
+ } else if (LastPoll_ + TDuration::MilliSeconds(5) < now) {
if (EnterPollerCallback_) {
EnterPollerCallback_->OnEnterPoller();
}
- Poll(now);
+ Poll(now);
if (EnterPollerCallback_) {
EnterPollerCallback_->OnExitPoller();
}
- }
+ }
Ready_.Append(ReadyNext_);
}
}
-void TContExecutor::Poll(TInstant deadline) {
- Poller_.Wait(PollerEvents_, deadline);
- LastPoll_ = Now();
-
- // Waking a coroutine puts it into ReadyNext_ list
- for (auto event : PollerEvents_) {
+void TContExecutor::Poll(TInstant deadline) {
+ Poller_.Wait(PollerEvents_, deadline);
+ LastPoll_ = Now();
+
+ // Waking a coroutine puts it into ReadyNext_ list
+ for (auto event : PollerEvents_) {
auto* lst = (NCoro::TPollEventList*)event.Data;
const int status = event.Status;
@@ -276,36 +276,36 @@ void TContExecutor::ScheduleExecutionNow(TCont* cont) noexcept {
Ready_.PushBack(cont);
}
-namespace {
+namespace {
inline TContExecutor*& ThisThreadExecutor() {
struct TThisThreadExecutorHolder {
- TContExecutor* Executor = nullptr;
+ TContExecutor* Executor = nullptr;
};
return FastTlsSingletonWithPriority<TThisThreadExecutorHolder, 0>()->Executor;
}
-}
-
+}
+
void TContExecutor::DeleteScheduled() noexcept {
ToDelete_.ForEach([this](TCont* c) {
Release(c);
});
}
-TCont* RunningCont() {
+TCont* RunningCont() {
TContExecutor* thisThreadExecutor = ThisThreadExecutor();
- return thisThreadExecutor ? thisThreadExecutor->Running() : nullptr;
-}
-
+ return thisThreadExecutor ? thisThreadExecutor->Running() : nullptr;
+}
+
void TContExecutor::RunScheduler() noexcept {
try {
- TContExecutor* const prev = ThisThreadExecutor();
+ TContExecutor* const prev = ThisThreadExecutor();
ThisThreadExecutor() = this;
TCont* caller = Current_;
TExceptionSafeContext* context = caller ? caller->Trampoline_.Context() : &SchedContext_;
- Y_DEFER {
- ThisThreadExecutor() = prev;
- };
-
+ Y_DEFER {
+ ThisThreadExecutor() = prev;
+ };
+
while (true) {
if (ScheduleCallback_ && Current_) {
ScheduleCallback_->OnUnschedule(*this);
@@ -345,7 +345,7 @@ void TContExecutor::RunScheduler() noexcept {
}
}
} catch (...) {
- TBackTrace::FromCurrentException().PrintTo(Cerr);
+ 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..a055012f3f 100644
--- a/library/cpp/coroutine/engine/impl.h
+++ b/library/cpp/coroutine/engine/impl.h
@@ -121,9 +121,9 @@ private:
bool Scheduled_ = false;
};
-TCont* RunningCont();
-
+TCont* RunningCont();
+
template <class Functor>
static void ContHelperFunc(TCont* cont, void* arg) {
(*((Functor*)(arg)))(cont);
@@ -134,15 +134,15 @@ static void ContHelperMemberFunc(TCont* c, void* arg) {
((reinterpret_cast<T*>(arg))->*M)(c);
}
-class IUserEvent
- : public TIntrusiveListItem<IUserEvent>
-{
-public:
- virtual ~IUserEvent() = default;
-
- virtual void Execute() = 0;
-};
-
+class IUserEvent
+ : public TIntrusiveListItem<IUserEvent>
+{
+public:
+ virtual ~IUserEvent() = default;
+
+ virtual void Execute() = 0;
+};
+
/// Central coroutine class.
/// Note, coroutines are single-threaded, and all methods must be called from the single thread
class TContExecutor {
@@ -249,22 +249,22 @@ public:
return FailOnError_;
}
- void RegisterInWaitQueue(NCoro::TContPollEvent* event) {
- WaitQueue_.Register(event);
- }
-
+ void RegisterInWaitQueue(NCoro::TContPollEvent* event) {
+ WaitQueue_.Register(event);
+ }
+
void ScheduleIoWait(TFdEvent* event) {
- RegisterInWaitQueue(event);
+ RegisterInWaitQueue(event);
Poller_.Schedule(event);
}
void ScheduleIoWait(TTimerEvent* event) noexcept {
- RegisterInWaitQueue(event);
+ RegisterInWaitQueue(event);
}
- void ScheduleUserEvent(IUserEvent* event) {
- UserEvents_.PushBack(event);
- }
+ void ScheduleUserEvent(IUserEvent* event) {
+ UserEvents_.PushBack(event);
+ }
void Pause();
TInstant Now();
@@ -285,7 +285,7 @@ private:
void WaitForIO();
- void Poll(TInstant deadline);
+ void Poll(TInstant deadline);
private:
NCoro::IScheduleCallback* const ScheduleCallback_ = nullptr;
@@ -300,11 +300,11 @@ private:
TContList ReadyNext_;
NCoro::TEventWaitQueue WaitQueue_;
NCoro::TContPoller Poller_;
- NCoro::TContPoller::TEvents PollerEvents_;
- TInstant LastPoll_;
-
- TIntrusiveList<IUserEvent> UserEvents_;
+ NCoro::TContPoller::TEvents PollerEvents_;
+ TInstant LastPoll_;
+ TIntrusiveList<IUserEvent> UserEvents_;
+
size_t Allocated_ = 0;
TCont* Current_ = nullptr;
bool FailOnError_ = false;
diff --git a/library/cpp/coroutine/engine/poller.cpp b/library/cpp/coroutine/engine/poller.cpp
index 61164fa56b..722ef1e3a6 100644
--- a/library/cpp/coroutine/engine/poller.cpp
+++ b/library/cpp/coroutine/engine/poller.cpp
@@ -46,11 +46,11 @@ namespace {
template <class T>
class TVirtualize: public IPollerFace {
public:
- TVirtualize(EContPoller pollerEngine)
- : PollerEngine_(pollerEngine)
- {
- }
-
+ TVirtualize(EContPoller pollerEngine)
+ : PollerEngine_(pollerEngine)
+ {
+ }
+
void Set(const TChange& c) override {
P_.Set(c);
}
@@ -59,12 +59,12 @@ namespace {
P_.Wait(events, deadLine);
}
- EContPoller PollEngine() const override {
- return PollerEngine_;
- }
+ EContPoller PollEngine() const override {
+ return PollerEngine_;
+ }
private:
T P_;
- const EContPoller PollerEngine_;
+ const EContPoller PollerEngine_;
};
@@ -366,21 +366,21 @@ THolder<IPollerFace> IPollerFace::Construct(TStringBuf name) {
THolder<IPollerFace> IPollerFace::Construct(EContPoller poller) {
switch (poller) {
case EContPoller::Default:
- case EContPoller::Combined:
- return MakeHolder<TVirtualize<TCombinedPoller>>(EContPoller::Combined);
+ case EContPoller::Combined:
+ return MakeHolder<TVirtualize<TCombinedPoller>>(EContPoller::Combined);
case EContPoller::Select:
- return MakeHolder<TVirtualize<TPoller<TGenericPoller<TSelectPoller<TWithoutLocking>>>>>(poller);
+ return MakeHolder<TVirtualize<TPoller<TGenericPoller<TSelectPoller<TWithoutLocking>>>>>(poller);
case EContPoller::Poll:
- return MakeHolder<TVirtualize<TPollPoller>>(poller);
+ return MakeHolder<TVirtualize<TPollPoller>>(poller);
case EContPoller::Epoll:
#if defined(HAVE_EPOLL_POLLER)
- return MakeHolder<TVirtualize<TPoller<TGenericPoller<TEpollPoller<TWithoutLocking>>>>>(poller);
+ return MakeHolder<TVirtualize<TPoller<TGenericPoller<TEpollPoller<TWithoutLocking>>>>>(poller);
#else
return nullptr;
#endif
case EContPoller::Kqueue:
#if defined(HAVE_KQUEUE_POLLER)
- return MakeHolder<TVirtualize<TPoller<TGenericPoller<TKqueuePoller<TWithoutLocking>>>>>(poller);
+ return MakeHolder<TVirtualize<TPoller<TGenericPoller<TKqueuePoller<TWithoutLocking>>>>>(poller);
#else
return nullptr;
#endif
diff --git a/library/cpp/coroutine/engine/poller.h b/library/cpp/coroutine/engine/poller.h
index 8ea012c0fc..ff60266d73 100644
--- a/library/cpp/coroutine/engine/poller.h
+++ b/library/cpp/coroutine/engine/poller.h
@@ -8,7 +8,7 @@
enum class EContPoller {
Default /* "default" */,
- Combined /* "combined" */,
+ Combined /* "combined" */,
Select /* "select" */,
Poll /* "poll" */,
Epoll /* "epoll" */,
@@ -42,7 +42,7 @@ public:
virtual void Set(const TChange& change) = 0;
virtual void Wait(TEvents& events, TInstant deadLine) = 0;
- virtual EContPoller PollEngine() const = 0;
+ virtual EContPoller PollEngine() const = 0;
static THolder<IPollerFace> Default();
static THolder<IPollerFace> Construct(TStringBuf name);
diff --git a/library/cpp/coroutine/engine/sockpool.h b/library/cpp/coroutine/engine/sockpool.h
index 1ebb7e7b38..2afd5c709a 100644
--- a/library/cpp/coroutine/engine/sockpool.h
+++ b/library/cpp/coroutine/engine/sockpool.h
@@ -93,7 +93,7 @@ public:
: Impl_(nullptr)
{
}
-
+
TPooledSocket(TImpl* impl)
: Impl_(impl)
{
@@ -178,7 +178,7 @@ public:
} else {
ret = AllocateMore(conn);
}
-
+
ret.Impl_->Touch();
return ret;
@@ -189,10 +189,10 @@ public:
alive->Touch();
socket = TPooledSocket(alive);
return true;
- }
+ }
return false;
}
-
+
private:
TPooledSocket::TImpl* GetImpl() {
TGuard<TMutex> guard(Mutex_);
diff --git a/library/cpp/coroutine/engine/trampoline.cpp b/library/cpp/coroutine/engine/trampoline.cpp
index 10ea69ddc3..6857670e1e 100644
--- a/library/cpp/coroutine/engine/trampoline.cpp
+++ b/library/cpp/coroutine/engine/trampoline.cpp
@@ -38,9 +38,9 @@ TTrampoline::TTrampoline(NStack::IAllocator& allocator, ui32 stackSize, TFunc f,
return Stack_.Get();
}
- const char* TTrampoline::ContName() const noexcept {
- return Cont_->Name();
- }
+ const char* TTrampoline::ContName() const noexcept {
+ return Cont_->Name();
+ }
void TTrampoline::DoRunNaked() {
DoRun();
diff --git a/library/cpp/coroutine/engine/trampoline.h b/library/cpp/coroutine/engine/trampoline.h
index 37b61cf015..30cc079ab0 100644
--- a/library/cpp/coroutine/engine/trampoline.h
+++ b/library/cpp/coroutine/engine/trampoline.h
@@ -39,8 +39,8 @@ namespace NCoro {
}
void SwitchTo(TExceptionSafeContext* ctx) noexcept {
- Y_VERIFY(Stack_.LowerCanaryOk(), "Stack overflow (%s)", ContName());
- Y_VERIFY(Stack_.UpperCanaryOk(), "Stack override (%s)", ContName());
+ Y_VERIFY(Stack_.LowerCanaryOk(), "Stack overflow (%s)", ContName());
+ Y_VERIFY(Stack_.UpperCanaryOk(), "Stack override (%s)", ContName());
Ctx_.SwitchTo(ctx);
}
@@ -49,8 +49,8 @@ namespace NCoro {
void DoRunNaked() override;
private:
- const char* ContName() const noexcept;
- private:
+ const char* ContName() const noexcept;
+ private:
NStack::TStackHolder Stack_;
const TContClosure Clo_;
TExceptionSafeContext Ctx_;