aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/coroutine/engine
diff options
context:
space:
mode:
authorprout <prout@yandex-team.ru>2022-02-10 16:49:43 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:43 +0300
commitd2247f243d31adde8feb765324e40c83c5a90999 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/coroutine/engine
parent7b7fa28b9099b7adca890459a699c6ba5eeff4ca (diff)
downloadydb-d2247f243d31adde8feb765324e40c83c5a90999.tar.gz
Restoring authorship annotation for <prout@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine')
-rw-r--r--library/cpp/coroutine/engine/cont_poller.h2
-rw-r--r--library/cpp/coroutine/engine/coroutine_ut.cpp102
-rw-r--r--library/cpp/coroutine/engine/impl.h2
3 files changed, 53 insertions, 53 deletions
diff --git a/library/cpp/coroutine/engine/cont_poller.h b/library/cpp/coroutine/engine/cont_poller.h
index 6ae1b407bd7..b638b2df1af 100644
--- a/library/cpp/coroutine/engine/cont_poller.h
+++ b/library/cpp/coroutine/engine/cont_poller.h
@@ -102,7 +102,7 @@ namespace NCoro {
struct TValue: public T, public TObjectFromPool<TValue> {
TValue() {}
};
-
+
public:
TBigArray()
: Pool_(TMemoryPool::TExpGrow::Instance(), TDefaultAllocator::Instance())
diff --git a/library/cpp/coroutine/engine/coroutine_ut.cpp b/library/cpp/coroutine/engine/coroutine_ut.cpp
index 82afafcfa04..8b372496a2e 100644
--- a/library/cpp/coroutine/engine/coroutine_ut.cpp
+++ b/library/cpp/coroutine/engine/coroutine_ut.cpp
@@ -326,99 +326,99 @@ void TCoroTest::TestCondVar() {
}
namespace NCoroTestJoin {
- struct TSleepCont {
- const TInstant Deadline;
- int Result;
-
- inline void operator()(TCont* c) {
- Result = c->SleepD(Deadline);
- }
- };
-
- struct TReadCont {
- const TInstant Deadline;
- const SOCKET Sock;
- int Result;
-
- inline void operator()(TCont* c) {
- char buf = 0;
+ struct TSleepCont {
+ const TInstant Deadline;
+ int Result;
+
+ inline void operator()(TCont* c) {
+ Result = c->SleepD(Deadline);
+ }
+ };
+
+ struct TReadCont {
+ const TInstant Deadline;
+ const SOCKET Sock;
+ int Result;
+
+ inline void operator()(TCont* c) {
+ char buf = 0;
Result = NCoro::ReadD(c, Sock, &buf, sizeof(buf), Deadline).Status();
- }
- };
-
- struct TJoinCont {
- const TInstant Deadline;
- TCont* const Cont;
- bool Result;
-
- inline void operator()(TCont* c) {
- Result = c->Join(Cont, Deadline);
- }
- };
-
+ }
+ };
+
+ struct TJoinCont {
+ const TInstant Deadline;
+ TCont* const Cont;
+ bool Result;
+
+ inline void operator()(TCont* c) {
+ Result = c->Join(Cont, Deadline);
+ }
+ };
+
void DoTestJoin(EContPoller pollerType) {
auto poller = IPollerFace::Construct(pollerType);
-
+
if (!poller) {
return;
}
-
+
TContExecutor e(32000, std::move(poller));
-
+
TPipe in, out;
TPipe::Pipe(in, out);
SetNonBlock(in.GetHandle());
-
+
{
TSleepCont sc = {TInstant::Max(), 0};
TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(sc, "sc"), true};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(sc.Result, ECANCELED);
UNIT_ASSERT_EQUAL(jc.Result, false);
}
-
+
{
TSleepCont sc = {TDuration::MilliSeconds(100).ToDeadLine(), 0};
TJoinCont jc = {TDuration::MilliSeconds(200).ToDeadLine(), e.Create(sc, "sc"), false};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(sc.Result, ETIMEDOUT);
UNIT_ASSERT_EQUAL(jc.Result, true);
}
-
+
{
TSleepCont sc = {TDuration::MilliSeconds(200).ToDeadLine(), 0};
TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(sc, "sc"), true};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(sc.Result, ECANCELED);
UNIT_ASSERT_EQUAL(jc.Result, false);
}
-
+
{
TReadCont rc = {TInstant::Max(), in.GetHandle(), 0};
TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(rc, "rc"), true};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(rc.Result, ECANCELED);
UNIT_ASSERT_EQUAL(jc.Result, false);
}
-
+
{
TReadCont rc = {TDuration::MilliSeconds(100).ToDeadLine(), in.GetHandle(), 0};
TJoinCont jc = {TDuration::MilliSeconds(200).ToDeadLine(), e.Create(rc, "rc"), false};
-
+
e.Execute(jc);
-
+
UNIT_ASSERT_EQUAL(rc.Result, ETIMEDOUT);
UNIT_ASSERT_EQUAL(jc.Result, true);
}
-
+
{
TReadCont rc = {TDuration::MilliSeconds(200).ToDeadLine(), in.GetHandle(), 0};
TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(rc, "rc"), true};
@@ -428,9 +428,9 @@ namespace NCoroTestJoin {
UNIT_ASSERT_EQUAL(rc.Result, ECANCELED);
UNIT_ASSERT_EQUAL(jc.Result, false);
}
- }
-}
-
+ }
+}
+
void TCoroTest::TestJoinDefault() {
NCoroTestJoin::DoTestJoin(EContPoller::Default);
}
diff --git a/library/cpp/coroutine/engine/impl.h b/library/cpp/coroutine/engine/impl.h
index 53511287a3e..283a96ecf11 100644
--- a/library/cpp/coroutine/engine/impl.h
+++ b/library/cpp/coroutine/engine/impl.h
@@ -104,7 +104,7 @@ public:
void SwitchTo(TExceptionSafeContext* ctx) {
Trampoline_.SwitchTo(ctx);
}
-
+
private:
void Terminate();