Created
November 30, 2021 10:38
-
-
Save HappyCerberus/e822fb0edf6b61609472795fc8231d97 to your computer and use it in GitHub Desktop.
[Article] C++20 Practical Coroutines - scheduler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scheduler_task main_scheduler_impl() { | |
auto &promise = co_await scheduler_task::get_promise; | |
while (true) { | |
for (auto &em : promise.emitters_) { | |
for (auto *ev = em->emit(); ev != nullptr; ev = em->emit()) { | |
co_yield ev; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment