From Eager Futures/Promises to Lazy Continuations: Evolving an Actor Library Based on Lessons LearnedFrom Eager Futures/Promises to Lazy Continuations Evolving an Actor Library Based on Lessons Learned from Large-Scale Deployments Benjamin Hindman @benh CppCon 2021prologue ● past life at UC motivating futures/promises + actors (2) libprocess (3) revisiting the problem (4) evolution of libprocess (5) eventuals (6) scheduling (7) streams (8) type erasurechapters (1) motivating futures/promises different language (e.g., Erlang) … or bring Erlang to C++! use callbacks … more on this later use futures/promises …possible solutions just wait … use threads … too expensive, not conducive to correctness0 码力 | 264 页 | 588.96 KB | 6 月前3
Tornado 4.5 Documentation
automatically by pip or setup.py install, the following optional packages may be useful: • concurrent.futures is the recommended thread pool for use with Tornado and enables the use of ThreadedResolver. It my_future.set_result(f.result())) return my_future The raw Future version is more complex, but Futures are nonetheless recommended practice in Tornado because they have two major advantages. Error handling exception (as opposed to the ad-hoc error handling common in callback-oriented interfaces), and Futures lend themselves well to use with coroutines. Coroutines will be discussed in depth in the next section0 码力 | 222 页 | 833.04 KB | 1 年前3
Tornado 5.1 Documentation
in Tornado generally return placeholder objects (Futures), with the exception of some low-level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the exceptions have somewhere to go. • Decorated coroutines have additional integration with the concurrent.futures package, allowing the re- sult of executor.submit to be yielded directly. For native coroutines, way to call a blocking function from a coroutine is to use IOLoop.run_in_executor, which returns Futures that are compatible with coroutines: async def call_blocking(): await IOLoop.current().run_in_executor(None0 码力 | 243 页 | 895.80 KB | 1 年前3
Tornado 6.1 Documentation
in Tornado generally return placeholder objects (Futures), with the exception of some low-level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the have somewhere to go. • Decorated coroutines: – have additional integration with the concurrent.futures package, allowing the result of executor.submit to be yielded directly. For native coroutines, use way to call a blocking function from a coroutine is to use IOLoop.run_in_executor, which returns Futures that are compatible with coroutines: async def call_blocking(): await IOLoop.current().run_in_executor(None0 码力 | 245 页 | 904.24 KB | 1 年前3
Tornado 6.0 Documentation
in Tornado generally return placeholder objects (Futures), with the exception of some low-level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the have somewhere to go. • Decorated coroutines: – have additional integration with the concurrent.futures package, allowing the result of executor.submit to be yielded directly. For native coroutines, use way to call a blocking function from a coroutine is to use IOLoop.run_in_executor, which returns Futures that are compatible with coroutines: async def call_blocking(): await IOLoop.current().run_in_executor(None0 码力 | 245 页 | 885.76 KB | 1 年前3
Tornado 6.4 Documentation
in Tornado generally return placeholder objects (Futures), with the exception of some low- level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the have somewhere to go. • Decorated coroutines: – have additional integration with the concurrent.futures package, allowing the result of executor. submit to be yielded directly. For native coroutines, use way to call a blocking function from a coroutine is to use IOLoop.run_in_executor, which returns Futures that are compatible with coroutines: async def call_blocking(): await IOLoop.current().run_in_executor(None0 码力 | 268 页 | 1.09 MB | 1 年前3
Tornado 6.4 Documentation
in Tornado generally return placeholder objects (Futures), with the exception of some low- level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the have somewhere to go. • Decorated coroutines: – have additional integration with the concurrent.futures package, allowing the result of executor. submit to be yielded directly. For native coroutines, use way to call a blocking function from a coroutine is to use IOLoop.run_in_executor, which returns Futures that are compatible with coroutines: async def call_blocking(): await IOLoop.current().run_in_executor(None0 码力 | 268 页 | 1.09 MB | 1 年前3
Tornado 6.4 Documentation
in Tornado generally return placeholder objects (Futures), with the exception of some low- level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the have somewhere to go. • Decorated coroutines: – have additional integration with the concurrent.futures package, allowing the result of executor. submit to be yielded directly. For native coroutines, use way to call a blocking function from a coroutine is to use IOLoop.run_in_executor, which returns Futures that are compatible with coroutines: async def call_blocking(): await IOLoop.current().run_in_executor(None0 码力 | 268 页 | 1.09 MB | 1 年前3
Tornado 6.3 Documentation
in Tornado generally return placeholder objects (Futures), with the exception of some low- level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the have somewhere to go. • Decorated coroutines: – have additional integration with the concurrent.futures package, allowing the result of executor. submit to be yielded directly. For native coroutines, use way to call a blocking function from a coroutine is to use IOLoop.run_in_executor, which returns Futures that are compatible with coroutines: async def call_blocking(): await IOLoop.current().run_in_executor(None0 码力 | 264 页 | 1.06 MB | 1 年前3
Tornado 6.2 Documentation
in Tornado generally return placeholder objects (Futures), with the exception of some low- level components like the IOLoop that use callbacks. Futures are usually transformed into their result with the have somewhere to go. • Decorated coroutines: – have additional integration with the concurrent.futures package, allowing the result of executor. submit to be yielded directly. For native coroutines, use way to call a blocking function from a coroutine is to use IOLoop.run_in_executor, which returns Futures that are compatible with coroutines: async def call_blocking(): await IOLoop.current().run_in_executor(None0 码力 | 260 页 | 1.06 MB | 1 年前3
共 292 条
- 1
- 2
- 3
- 4
- 5
- 6
- 30













