Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.

Commit 6e8a0d6

Browse files
sylvainbvxgmichel
authored andcommitted
Added some comments
1 parent e6e4041 commit 6e8a0d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/producer_consumer_join.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ async def consume(queue):
2929

3030
async def run(n):
3131
queue = asyncio.Queue()
32+
# register the consume coroutine
3233
consumer = asyncio.ensure_future(consume(queue))
34+
# launch the producer and wait for completion
3335
await produce(queue, n)
36+
# ensure the consumer consumes all produced items
3437
await queue.join()
38+
# consumer is always awaiting for a new item, cancel it
3539
consumer.cancel()
3640

3741

0 commit comments

Comments
 (0)