Skip to content

Instantly share code, notes, and snippets.

@eahydra
Last active September 25, 2021 09:16
Show Gist options
  • Save eahydra/5237527 to your computer and use it in GitHub Desktop.
Save eahydra/5237527 to your computer and use it in GitHub Desktop.
asio's truth code
void coroutine_executor_ex() {
std::cout<<__FUNCTION__<<std::endl;
coroutine_ref _coro_value = this;
switch (_coro_value)
{
case -1:
{
if (_coro_value)
{
goto terminate_coroutine;
terminate_coroutine:
_coro_value = -1;
goto bail_out_of_coroutine;
bail_out_of_coroutine:
break;
}
else
{
case 0:
{
std::cout<<"befor yield 1"<<std::endl;
// begin yield!!!!!
for (_coro_value = 999;;)
{
if (_coro_value == 0) {
case 999:;
break;
} else {
switch (_coro_value ? 0 : 1)
{
for (;;)
{
case -1:
{
if (_coro_value) {
goto terminate_coroutine;
}
else {
for (;;)
{
case 1: {
if (_coro_value) {
goto bail_out_of_coroutine;
}
else {
case 0: {
task_thread_pool_.post_task([&](){
std::cout<<"yield 1"<<std::endl;
coroutine_executor_ex();
});
}
}
}
}
}
}
}
}
}
}
std::cout<<"after yield 1"<<std::endl;
for (_coro_value = 1111;;)
{
if (_coro_value == 0) {
case 1111:;
break;
} else {
switch (_coro_value ? 0 : 1)
{
for (;;)
{
case -1:
{
if (_coro_value) {
goto terminate_coroutine;
}
else {
for (;;)
{
case 1: {
if (_coro_value) {
goto bail_out_of_coroutine;
}
else {
case 0: {
task_thread_pool_.post_task([&](){
std::cout<<"yield 2"<<std::endl;
coroutine_executor_ex();
});
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment