-
-
Notifications
You must be signed in to change notification settings - Fork 167
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(coro): coro 2.0 #1188
feat(coro): coro 2.0 #1188
Conversation
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
This is huge, god damn. I'll pull this branch locally and test this with my bot, will give you a shout on Discord if I have any issues! |
lgtm, will test it out when its in dev as the coro features in my bot arent complete so i can't test this thoroughly. |
* @attention This will BLOCK THE THREAD. It is likely you want to use co_await instead. | ||
* @param duration Maximum duration to wait for | ||
* @retval If T is void, returns a boolean for which true means the awaitable completed, false means it timed out. | ||
* @retval If T is non-void, returns a std::optional<T> for which an absense of value means timed out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: fix "absence"
return static_cast<const detail::task::task_base<R>&>(*this); | ||
~task() { | ||
if (handle && this->valid()) { | ||
if (this->abandon() & state_flags::sf_done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: don't use an implicit conversion to bool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: note
Closing to reopen from https://github.com/brainboxdotcc/DPP/tree/coro |
This is a massive PR that fundamentally changes the coro implementation, everything is a derivative of dpp::awaitable and dpp::promise now. This helps with de-duplicating a lot of coro-related code, making it easier to maintain, and offers a way to add things to all of the coroutine types at once, for example the
sync_wait
method available on all awaitable types, which can help for example with starting a coroutine from a non-coroutine.Still missing some documentation & polishing
Code change checklist