Tornado 6.5 Documentation
kinds of coroutines it is important to use await or yield so that any exceptions have somewhere to go. • Decorated coroutines: – have additional integration with the concurrent.futures package, allowing yielded. This means it is important to call coroutines in the right way, or you may have errors that go unnoticed: async def divide(x, y): return x / y def bad_call(): # This should raise a ZeroDivisionError stored in the Future object. You must examine the result of the Future object, or the exception may go unnoticed by your code. This means yielding the function if called from another coroutine, using something0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
kinds of coroutines it is important to use await or yield so that any exceptions have somewhere to go. Decorated coroutines: have additional integration with the concurrent.futures [https://docs.python yielded. This means it is important to call coroutines in the right way, or you may have errors that go unnoticed: async def divide(x, y): return x / y def bad_call(): # This should raise a stored in the Future object. You must examine the result of the Future object, or the exception may go unnoticed by your code. This means yielding the function if called from another coroutine, using something0 码力 | 437 页 | 405.14 KB | 2 月前3Rust 程序设计语言 简体中文版 1.85.0
中添加想要复用的代码: 文件名:tests/common.rs pub fn setup() { // setup code specific to your library's tests would go here } 如果再次运行测试,将会在测试结果中看到一个新的对应 common.rs 文件的测试结果部分, 即便这个文件并没有包含任何测试函数,也没有任何地方调用了 setup 函数: 246/562Rust 简体中文版 使用消息传递在线程间传送数据 一个日益流行的确保安全并发的方式是消息传递(message passing),这里线程或 actor 通过 发送包含数据的消息来相互沟通。这个思想来源于 Go 编程语言文档 中的口号:“不要通过共 享内存来通讯;而要通过通讯来共享内存。”(“Do not communicate by sharing memory; instead, share memory 的并发方式吧。 366/562Rust 程序设计语言 简体中文版 共享状态的并发 消息传递是一个很好的处理并发的方式,但并不是唯一一个。另一种方式是让多个线程访问相 同的共享数据。再考虑一下 Go 语言文档中的这句口号:“不要通过共享内存来通讯”。(“do not communicate by sharing memory.”) 通过共享内存进行通信,会是什么样的代码?此外,为什么喜欢消息传递的人会警告说谨慎使0 码力 | 562 页 | 3.23 MB | 10 天前3
共 3 条
- 1