summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2022-03-10 17:01:23 (GMT)
committerGitHub <noreply@github.com>2022-03-10 17:01:23 (GMT)
commita0eb69c1a2e3aee75cb48e9868ef06a531b94a70 (patch)
tree3dc104018dbbdf5d14c5852c9e21ba04bf9af5bb /Doc
parent7854012077009b9f364f198a8ae38b546ec58313 (diff)
downloadcpython-a0eb69c1a2e3aee75cb48e9868ef06a531b94a70.zip
cpython-a0eb69c1a2e3aee75cb48e9868ef06a531b94a70.tar.gz
cpython-a0eb69c1a2e3aee75cb48e9868ef06a531b94a70.tar.bz2
Remove print race from task_done example. (GH-31795)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/queue.rst7
1 files changed, 3 insertions, 4 deletions
diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst
index 0ec5900..cbf27d2 100644
--- a/Doc/library/queue.rst
+++ b/Doc/library/queue.rst
@@ -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')