drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.04k stars 1.06k forks source link

能否callback接口和协程接口混用,我的意思是不同的controller或者在协程controller使用异步sql,这会造成什么意想不到的结果吗?感谢回答! #1985

Closed MasterYC closed 3 months ago

MasterYC commented 3 months ago

Notice If you need support or clarification regarding the usage of Drogon in your project, visit the official Drogon support channel at gitter

Please create a new issue only if you think you have found a bug or if have a feature request/enhancement.

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

MasterYC commented 3 months ago

还有个问题就是非fastdb不是共用一个loop,这个也可以使用协程吗

an-tao commented 3 months ago

可以,但要注意co_await之后就切换到dbclient的IO线程了。

MasterYC commented 3 months ago

可以,但要注意co_await之后就切换到dbclient的IO线程了。

标题的问题能回答一下吗,谢谢

an-tao commented 3 months ago

可以混用,协程和callback本质是一样的,请参考https://github.com/drogonframework/drogon/wiki/CHN-FAQ-1-%E7%BA%BF%E7%A8%8B%E6%A8%A1%E5%9E%8B