Skip to content

Commit

Permalink
Remove print race from task_done example. (GH-31795)
Browse files Browse the repository at this point in the history
(cherry picked from commit a0eb69c)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
  • Loading branch information
miss-islington and rhettinger authored Mar 10, 2022
1 parent 5dfe981 commit 3386f87
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Doc/library/queue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,14 @@ Example of how to wait for enqueued tasks to be completed::
print(f'Finished {item}')
q.task_done()

# turn-on the worker thread
# Turn-on the worker thread.
threading.Thread(target=worker, daemon=True).start()

# send thirty task requests to the worker
# Send thirty task requests to the worker.
for item in range(30):
q.put(item)
print('All task requests sent\n', end='')

# block until all tasks are done
# Block until all tasks are done.
q.join()
print('All work completed')

Expand Down

0 comments on commit 3386f87

Please sign in to comment.