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

slytomcat report at bugs.python.org
Tue Feb 21 10:38:22 EST 2017


slytomcat added the comment:

Not exactly.... there are 3 cases:

If qsize <> 0 it means there is no idle consumers threads, all of them must be busy: we need to create one more. No doubt.

If qsize = 0 it means one of two cases: 
- all consumers threads are busy: we need to create one more
- some or all consumers threads are idle: no need create new one.

But there is no way to distinguish two last cases.

That's why I consider that (unfinished() <= num_threads) gives clear key for decision.

----------

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


More information about the Python-bugs-list mailing list