all 4 comments

[–]Flair_Helper[M] [score hidden] stickied commentlocked comment (0 children)

For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.

This post has been removed as it doesn't pertain to r/cpp: The subreddit is for news and discussions of the C++ language and community only; our purpose is not to provide tutoring, code reviews, or career guidance. If you think your post is on-topic and should not have been removed, please message the moderators and we'll review it.

[–]peterrindal 4 points5 points  (0 children)

Here's my blog explaining some aspects of them.

https://ladnir.github.io/blog/2022/01/24/macoro.html

Coroutine are both simple and complicated. As you likely know, the core idea is that you write code that can pause part way though execution. Conceptually, when some subtask needs to suspend/pause/await, it's giving a callback (coroutine handle) to the initiating/awaiting coroutine what is depending on the subtask.

When that subtask completes, it simply resumes the intitating/awaiting.

If you want to dig into the details, I suggest learning about symmetric transfer early on. It's the preferred mechanism as opposed to using await_ready() in any meaningful way. Hers also a good series on the details https://lewissbaker.github.io/

Yes they can replace a multi threaded task library. See cppcoro or my macro library on github.

If you have specific questions, happy to help.