Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决 handle.resume 和 return noop_coroutine 的竞争问题。 #36

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

microcai
Copy link
Member

这是微软编译器的一个 bug。只在 debug 模式下有。
不过如果改成 bool 返回值,功能也是相同的。
就绕过了 微软的 bug。

@microcai microcai force-pushed the fix_face_on_resume_noop_coro branch from 5378801 to 361a0a1 Compare October 17, 2024 15:36
@microcai microcai marked this pull request as ready for review October 17, 2024 15:41
}
else
{
// 如果执行到这里,说明 resume_coro 肯定没被执行,说明协程唤醒是由 executor 驱动,此时
// 即返回 noop_coroutine 即可.
return std::noop_coroutine();
// 即返回 true 即可. 即不切换协程.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更清晰的注释:
返回 true 表示将当前协程的控制权通过手动 resume 来恢复执行。

这是微软编译器的一个 bug。只在 debug 模式下有。
不过如果改成 bool 返回值,功能也是相同的。
就绕过了 微软的 bug。
@microcai microcai force-pushed the fix_face_on_resume_noop_coro branch from 361a0a1 to d1d375e Compare October 17, 2024 15:51
@microcai microcai merged commit 2df7bdf into master Oct 17, 2024
12 checks passed
@microcai microcai deleted the fix_face_on_resume_noop_coro branch October 17, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants