-
Notifications
You must be signed in to change notification settings - Fork 957
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
C++20 coroutine support #1155
Comments
@simue thanks for your request! Yes, coroutine are still a feature I consider would be awesome for cpr and I would love to have them supported. I focus right now on fixing existing bugs compared to adding huge new features. But I'm always welcoming PRs that add such functionality. |
Thanks for the clarification, sounds good! However, I am now doubting whether this is a good idea, actually. Currently async requests seem to be implemented such that every request is executed in its own thread. The thread is blocking for the response ( What are your thoughts on this? |
Yes. You are right. In the best case we could merge both. |
Sorry, but I think this is more effort than what I can invest here currently. |
OK, no problem! Thanks for reporting back to me! |
Is your feature request related to a problem?
Compared with async callback chains, coroutines look like they offer a natural way to write transactions consisting of several chained http requests.
Compared with implementing transactions sequentially and achieving parallelism by one thread per transaction, coroutines would save ressources.
In #382 coroutines were hinted, but did not make it into the final implementation.
So essentially I just have one question: Is this still being considered? If not: what were the reasons that speak against coroutines in libcpr?
I am just getting into coroutines in C++, so if there are technical reasons that speak against adding coroutines to libcpr, please let me know.
Possible Solution
Having awaitable http requests to achieve something along the lines of:
honestly I have no clear picture of coroutines, yet. So the idea is to have awaitable functions for http requests that are then easily chainable in a clear and concise way.
Alternatives
One could alternatively use threads with sequentially implemented transactions, or chaining async callbacks with e.g. cpr's
GetCallback()
Both have downsides described in my initial statement
Additional Context
No response
The text was updated successfully, but these errors were encountered: