From Eager Futures/Promises to Lazy Continuations: Evolving an Actor Library Based on Lessons Learned
From 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 | 5 月前3Tornado 4.5 Documentation
setup.py install, the following optional packages may be useful: concurrent.futures [https://pypi.python.org/pypi/futures] is the recommended thread pool for use with Tornado and enables the use of ThreadedResolver concurrency tornado.gen — Simplify asynchronous code tornado.concurrent — Work with threads and futures tornado.locks – Synchronization primitives tornado.queues – Queues for coroutines tornado.process 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 handling0 码力 | 333 页 | 322.34 KB | 1 年前3Tornado 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 coroutines have additional integration with the concurrent.futures [https://docs.python.org/3.6/library/concurrent.futures.html#module-concurrent.futures] package, allowing the result of executor.submit to be 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 码力 | 359 页 | 347.32 KB | 1 年前3Tornado 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 coroutines: have additional integration with the concurrent.futures [https://docs.python.org/3.6/library/concurrent.futures.html#module-concurrent.futures] package, allowing the result of executor.submit to be 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 码力 | 869 页 | 692.83 KB | 1 年前3Tornado 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 coroutines: have additional integration with the concurrent.futures [https://docs.python.org/3.6/library/concurrent.futures.html#module-concurrent.futures] package, allowing the result of executor.submit to be 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 码力 | 931 页 | 708.03 KB | 1 年前3Tornado 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 coroutines: have additional integration with the concurrent.futures [https://docs.python.org/3/library/concurrent.futures.html#module-concurrent.futures] package, allowing the result of executor.submit to be 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 码力 | 407 页 | 385.03 KB | 1 年前3Tornado 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 coroutines: have additional integration with the concurrent.futures [https://docs.python.org/3/library/concurrent.futures.html#module-concurrent.futures] package, allowing the result of executor.submit to be 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 码力 | 432 页 | 402.58 KB | 1 年前3Tornado 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 coroutines: have additional integration with the concurrent.futures [https://docs.python.org/3/library/concurrent.futures.html#module-concurrent.futures] package, allowing the result of executor.submit to be 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 码力 | 432 页 | 402.58 KB | 1 年前3Tornado 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 coroutines: have additional integration with the concurrent.futures [https://docs.python.org/3/library/concurrent.futures.html#module-concurrent.futures] package, allowing the result of executor.submit to be 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 码力 | 432 页 | 402.58 KB | 1 年前3Tornado 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 coroutines: have additional integration with the concurrent.futures [https://docs.python.org/3/library/concurrent.futures.html#module-concurrent.futures] package, allowing the result of executor.submit to be 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 码力 | 423 页 | 398.18 KB | 1 年前3
共 354 条
- 1
- 2
- 3
- 4
- 5
- 6
- 36