<div dir="ltr"><div dir="ltr">Hello,<div><br></div><div>I copy paste the main idea from an article I have written:</div><div><a href="https://pythonc.home.blog/2018/12/14/premier-article-de-blog/">contextual async</a><br></div><div><br></div><div>"</div><div><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">Imagine you have some code written for monothread. And you want to include your code in a multithread environment.  Do you need to adapt all your code which is what you do when you want to migrate to async code ? The answer is no.</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">Functionnally these constraints are not justified neither technically</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">Do we have the tools to do this ? Yes because thanks to boost::context we can switch context between tasks. When a task suspends, it just calls a function (the event loop or reactor) to potentially switch to another task. Just like threads switch contexts…</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif"><span style="font-weight:700">Async/Await logic has introduced a symetric relation wich introduces unnecessary contraints. We should just the same logic as thread logic</span>.</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">"</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">Read the examples in the article I have developped a prototype in C++ and everything works perfectly.</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">My opinion is that sooner or later, it will have to switch to this logic because chaining async/aswait is a huge contraints and does not make sense in my opinion.</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">Maybe I am missing something,</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">Feel free to give me your feedback.</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif">Regards,</p><p style="margin-bottom:0.875em;color:rgb(56,56,56);font-family:Georgia,"Times New Roman",serif"><br>Chris</p></div><div><br></div></div></div>