This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Queue documentation note needed
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Sandy Chapman, docs@python, r.david.murray, rhettinger
Priority: normal Keywords:

Created on 2015-05-27 12:22 by Sandy Chapman, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg244156 - (view) Author: Sandy Chapman (Sandy Chapman) Date: 2015-05-27 12:22
The example at the bottom of the following page should have a warning added:

https://docs.python.org/2/library/queue.html

The warning should be such that the user is informed that the threads in the example are not cleaned up and will continue to run. Any future additions to the queue will then be processed immediately by those threads.
msg244167 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-05-27 13:27
If you know anything about threads you can see that the threads are not explicitly shut down.  As a standalone example it is "correct", in that they get shut down at interpreter shutdown.

I'm not sure it is appropriate to include what is essentially a thread tutorial note in the queue docs.  A crosslink to threading would certainly be a good idea; perhaps the introductory sentence could be tweaked to point people who don't already know threads in the correct direction for enlightenment.
msg244171 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2015-05-27 15:02
It is normal for daemon threads to not be shut down.   That is why they exist.  The purpose of Queue.join() is to give other threads a way to know when daemons have finished doing their work (i.e. a print manager thread to indicate that it is done printing).  If the worker threads were actually going to terminate, you wouldn't need Queue.join(), you would use a Thread.join().
History
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68484
2016-04-26 08:22:04rhettingersetstatus: open -> closed
resolution: not a bug
2015-05-27 15:02:02rhettingersetmessages: + msg244171
2015-05-27 14:54:44rhettingersetassignee: docs@python -> rhettinger

nosy: + rhettinger
2015-05-27 13:27:30r.david.murraysetnosy: + r.david.murray
messages: + msg244167
2015-05-27 12:22:01Sandy Chapmancreate