diff options
author | nocomer <nocomer@yandex-team.com> | 2022-12-07 17:37:14 +0300 |
---|---|---|
committer | nocomer <nocomer@yandex-team.com> | 2022-12-07 17:37:14 +0300 |
commit | 073cfa733cd8ec817135f28cb8a2719452094d73 (patch) | |
tree | 5be69eaa31ee3bb9ed540c8aaca8177941597847 /library/cpp/coroutine/engine/impl.cpp | |
parent | 37030c245fe253ac59f915e72acb74d5e677cca0 (diff) | |
download | ydb-073cfa733cd8ec817135f28cb8a2719452094d73.tar.gz |
Improve error handling: add counters for internal, other and because of ban errors/fails, provide source of errors and reasons of coroutine cancellations
Diffstat (limited to 'library/cpp/coroutine/engine/impl.cpp')
-rw-r--r-- | library/cpp/coroutine/engine/impl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp index 08f358127d..ac116af0c1 100644 --- a/library/cpp/coroutine/engine/impl.cpp +++ b/library/cpp/coroutine/engine/impl.cpp @@ -41,14 +41,18 @@ void TCont::PrintMe(IOutputStream& out) const noexcept { << ")"; } -bool TCont::Join(TCont* c, TInstant deadLine) noexcept { +bool TCont::Join(TCont* c, TInstant deadLine, std::function<void(TJoinWait&, TCont*)> forceStop) noexcept { TJoinWait ev(*this); c->Waiters_.PushBack(&ev); do { if (SleepD(deadLine) == ETIMEDOUT || Cancelled()) { if (!ev.Empty()) { - c->Cancel(); + if (forceStop) { + forceStop(ev, c); + } else { + c->Cancel(); + } do { Switch(); @@ -108,7 +112,7 @@ void TCont::Cancel() noexcept { void TCont::Cancel(THolder<std::exception> exception) noexcept { if (!Cancelled()) { - Exception_ = std::move(exception); + SetException(std::move(exception)); Cancel(); } } |