Skip to content

Commit 45ea260

Browse files
ValentiWorkLearningVKorniienko
authored and
VKorniienko
committed
Fixed symmetric transfer instead of raw .resume() #17 [FLASH]
1 parent b2a7426 commit 45ea260

File tree

1 file changed

+6
-4
lines changed
  • Firmware/utils/inc/utils/coroutine

1 file changed

+6
-4
lines changed

Firmware/utils/inc/utils/coroutine/Task.hpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ template <typename TResult> struct Task
8282
{
8383
return !m_coroutine || m_coroutine.done();
8484
}
85-
void await_suspend(stdcoro::coroutine_handle<> awaitingRoutine)
85+
auto await_suspend(stdcoro::coroutine_handle<> awaitingRoutine)
8686
{
87+
// https://lewissbaker.github.io/2020/05/11/understanding_symmetric_transfer
8788
m_coroutine.promise().set_continuation(awaitingRoutine);
88-
m_coroutine.resume();
89+
return m_coroutine;
8990
}
9091

9192
decltype(auto) await_resume()
@@ -194,10 +195,11 @@ struct VoidTask
194195
{
195196
return !m_coroutine || m_coroutine.done();
196197
}
197-
void await_suspend(stdcoro::coroutine_handle<> awaitingRoutine)
198+
auto await_suspend(stdcoro::coroutine_handle<> awaitingRoutine)
198199
{
200+
// https://lewissbaker.github.io/2020/05/11/understanding_symmetric_transfer
199201
m_coroutine.promise().set_continuation(awaitingRoutine);
200-
m_coroutine.resume();
202+
return m_coroutine;
201203
}
202204

203205
void await_resume()

0 commit comments

Comments
 (0)