From 3386f87dcb2d305965293df18c6484de0dfa132d Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Thu, 10 Mar 2022 09:22:46 -0800 Subject: [PATCH] Remove print race from task_done example. (GH-31795) (cherry picked from commit a0eb69c1a2e3aee75cb48e9868ef06a531b94a70) Co-authored-by: Raymond Hettinger --- Doc/library/queue.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst index 0ec5900bef5b..cbf27d2bb10d 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') -- 2.47.3