彭于斌
彭于斌
说错了,是hello.resume。
return PreviousAwaiter(mPrevious) 等价于 mPrevious.resume() 而mPrevious是hello
为什么要用return PreviousAwaiter(mPrevious)而不是mPrevious.resume()? 因为后者会爆栈,因此C++提供了一种保证堆栈不会随着一次次返回越来越高的方法,那就是允许你返回一个你要resume的协程,让编译器在当前函数退出后,自动调用你返回的协程,称之为对称转移。 如果不考虑爆栈问题,你完全可以写mPrevious.resume(),然后只是返回void,这样更直观。 https://lewissbaker.github.io/2020/05/11/understanding_symmetric_transfer
不需要,因为在run_step中会将首个启动的协程的mPrevious设为noop_coroutine(),该协程是特殊的,执行没有任何效果,直接退出。
对的,就是这样,后来两个头文件改了文件位置,忘记改steps里的了
目前小彭老师忙于凡间业务,websocket是重要的功能,等我忙完后一定连夜支持 :+1:
已支持websocket,案例见`examples/websocket_server.cpp`和`examples/chat_server.cpp`
收到,等小彭老师忙完[小彭大典](https://github.com/parallel101/cppguidebook)就来支持rpc。
gcc 13.2.1
# Backgrounds C++ has a mechanism called argument-depandent lookup (ADL). That is, when invoking unqualified free-functions on objects, the namespace within which the object is defined will be take in...