-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
feat: coroutines "beta test" #763
Conversation
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
9dc4d8c
to
b13caae
Compare
40877c0
to
921e040
Compare
|
6e6ba3b
to
49b2cb5
Compare
Please wrap all C++20 specific features in a |
DPP_CORO covers that. |
NOTE: this commit is part of a PR that was reorganized through rebases, and is very likely to not compile
This is finally ready for review. 👍 |
Btw I suggest merging this PR normally, without squash, so each changes gets listed in the changelog one by one |
dpp::task - coroutine object
Hot start (starts on constructor), executes in parallel
Can be cancelled which will throw dpp::task_cancelled_exception after the next co_await
Cannot detach, task will cancel itself when destroyed
Can be co-awaited later to retrieve return value
Requires synchronization at the point of co_await and destruction (lock-free)
dpp::coroutine - coroutine object
Lazy start (starts on co_await)
Has a return value, retrieved on co_await
Cannot detach or run in parallel by design of lazy start
No synchronization, light object
dpp::job - coroutine object
Hot start, runs in parallel and detached always, destroys itself when done
Cannot be co_awaited
No synchronization, no return value, very light object
dpp::async - awaitable API request (previously dpp::awaitable)
Can be constructed from a function
e.g:
dpp:async request = cluster->co_message_create(dpp::message{"foobar"});
dpp::async request{cluster, &dpp::cluster::message_create, dpp::message{"foobar"}};
Hot start (starts on constructor), executes in parallel
Lock-free synchronization on co_await