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

feat(coro): coro 2.0 #1188

Closed
wants to merge 7 commits into from
Closed

feat(coro): coro 2.0 #1188

wants to merge 7 commits into from

Conversation

Mishura4
Copy link
Member

@Mishura4 Mishura4 commented Jul 6, 2024

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

  • I have ensured that all methods and functions are fully documented using doxygen style comments.
  • My code follows the coding style guide.
  • I tested that my change works before raising the PR.
  • I have ensured that I did not break any existing API calls.
  • I have not built my pull request using AI, a static analysis tool or similar without any human oversight.

@CLAassistant
Copy link

CLAassistant commented Jul 6, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

netlify bot commented Jul 6, 2024

Deploy Preview for dpp-dev ready!

Name Link
🔨 Latest commit 6eef94a
🔍 Latest deploy log https://app.netlify.com/sites/dpp-dev/deploys/668fdaea61faa60008cce518
😎 Deploy Preview https://deploy-preview-1188--dpp-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added documentation Improvements or additions to documentation code Improvements or additions to code. labels Jul 6, 2024
@Jaskowicz1
Copy link
Contributor

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!

@braindigitalis
Copy link
Contributor

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.
Copy link
Member Author

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) {
Copy link
Member Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

note to self: note

@Mishura4
Copy link
Member Author

Closing to reopen from https://github.com/brainboxdotcc/DPP/tree/coro

@Mishura4 Mishura4 closed this Jul 11, 2024
@Mishura4 Mishura4 mentioned this pull request Jul 11, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Improvements or additions to code. documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants