Replies: 5 comments 12 replies
-
ViaCoroutine 的主要用途是 co_await 用户自定义的 awaiter 时可以切换回来。 |
Beta Was this translation helpful? Give feedback.
-
SimpleExecutor e;
Lazy<void> bar() {}
Lazy<void> foo() {
co_await bar.via(&e); // 这个不属于用户定义的,但每次都要附带 `ViaCoroutine` 协程。
} |
Beta Was this translation helpful? Give feedback.
-
指的是非 Lazy 类型的其他 Awaiter |
Beta Was this translation helpful? Give feedback.
-
我的意思是像上面这种是否可以解决不需要附带 另,对于你说的非 Lazy 的 Awaiter, |
Beta Was this translation helpful? Give feedback.
-
RescheduleLazy 按设计其实本来只有 ReschduleLazy.start() 这种用法的,
无法判断其他 awaiter 中是否有 ex。如果你说判断 ex 是否非 null 的话,那本来就会判断吧。 |
Beta Was this translation helpful? Give feedback.
-
Search before asking
What happened + What you expected to happen
每次调用
RescheduleLazy
为了恢复到调用前所在的上下文,会通过ViaAsyncAwaiter
附带一个恢复的协程ViaCoroutine
。这个恢复的协程的逻辑是否可以合并到
FinalAwaiter
,避免需要多调用这个协程?Reproduction way
Anything else
Are you willing to submit a PR?
Beta Was this translation helpful? Give feedback.
All reactions