Thread-ID - how much could be?
airween at gmail.com
Thu Sep 11 23:32:29 CEST 2014
thanks for the reply,
On Thu, Sep 11, 2014 at 09:48:18PM +0200, Peter Otten wrote:
> Ervin Hegedüs wrote:
> > Exception in thread Thread-82:
> > ...
> > My question is: how much thread ID could be totally? Is there any
> > maximum number? And if the thread reached that, what will be
> > done? Overlflowed? Couting from 0 again?
> A quick peak into threading.py reveals
> # Helper to generate new thread names
> _counter = 0
> def _newname(template="Thread-%d"):
> global _counter
> _counter += 1
> return template % _counter
> class Thread:
> def __init__(self, group=None, target=None, name=None,
> args=(), kwargs=None, *, daemon=None):
> self._name = str(name or _newname())
> There is no upper limit to the thread name other than that you will
> eventually run out of memory ;)
thanks - I hope that the memory will not run out by these
Anyway, that means, on my system:
>>> import sys
>>> print sys.maxint
the couter could be 9223372036854775807?
And after? :)
I � UTF-8
More information about the Python-list