Tornado 6.5 Documentation
yields Queue.put pauses until there is room for another item. A Queue maintains a count of unfinished tasks, which begins at zero. put increments the count; task_done decrements it. In the web-spider example spawn_callback(consumer) await producer() # Wait for producer to put all tasks. await q.join() # Wait for consumer to finish all tasks. print('Done') asyncio.run(main()) Put 0 Put 1 Doing work on 0 Put callback-based equivalent. Similar to the first option, callback-based libraries are available for many tasks, although they are slightly more complicated to use than a library designed for coroutines. Adapt0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
yields Queue.put pauses until there is room for another item. A Queue maintains a count of unfinished tasks, which begins at zero. put increments the count; task_done decrements it. In the web-spider example spawn_callback(consumer) await producer() # Wait for producer to put all tasks. await q.join() # Wait for consumer to finish all tasks. print('Done') asyncio.run(main()) Put 0 Put 1 Doing work callback-based equivalent. Similar to the first option, callback-based libraries are available for many tasks, although they are slightly more complicated to use than a library designed for coroutines. Adapt0 码力 | 437 页 | 405.14 KB | 2 月前3
共 2 条
- 1
相关搜索词