[issue29603] More informative Queue class: new method that returns number of unfinished tasks

Raymond Hettinger report at bugs.python.org
Tue Feb 21 08:09:23 EST 2017


Raymond Hettinger added the comment:

> Should avoid creating new threads if there are more
# idle threads than items in the work queue.

Shouldn't this just check to see if qsize() is greater than zero?  That would mean that there are no idle threads.  I'm not seeing why there would be any idle threads if there is work in the queue (the queue unblocks idle threads).

I don't think "unfinished() - num_threads" makes sense.  The meaning of "unfinished() - qsize()" is the number of non-idle worker threads (work is taken out of the queue but has not yet reported that the task is done).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29603>
_______________________________________


More information about the Python-bugs-list mailing list