|
1
3
为了让您的代码编译和运行,我必须进行以下更改:
我还必须写下这个线束代码:
然后我更新了
现在,我可以像这样运行它:
输出: Done `Main`. 然后2秒后: Done `SendInvitation`. Done `CreateEvent`.
如果我只是换衣服
然后我得到这个输出: Done `Main`. Done `CreateEvent`. 然后2秒后: Done `SendInvitation`. 这似乎是你想要的。 |
|
|
2
3
简而言之,您不能保证代码的执行会完成。 这就是为什么ASP.NET核心具有用于后台工作的基础结构: Implementing background tasks in .NET Core 2.x webapps or microservices with IHostedService and the BackgroundService class |
|
|
Jess The Witch · GCP云功能中处理延迟任务的模式 1 年前 |
|
Plup · 连接失败时,PyMongo异步客户端未引发异常 1 年前 |
|
|
user1233894 · 尝试从全局函数传递值 1 年前 |
|
|
Fabiano Taioli · 管理单线程Rust中的阻塞函数 1 年前 |
|
|
river7816 · 为什么spdlog不在async函数中打印 1 年前 |