Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77780

Re: Thread-ID - how much could be?

Date 2014-09-11 23:32 +0200
From Ervin Hegedüs <airween@gmail.com>
Subject Re: Thread-ID - how much could be?
References <20140911193018.GA24416@arxnet.hu> <lusua3$a4t$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.13944.1410471154.18130.python-list@python.org> (permalink)

Show all headers | View raw


Hi Peter,

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
threads... :)

Anyway, that means, on my system:

>>> import sys
>>> print sys.maxint
9223372036854775807

the couter could be 9223372036854775807?

And after? :)


Thanks,


a.



 

-- 
I � UTF-8

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Thread-ID - how much could be? Ervin Hegedüs <airween@gmail.com> - 2014-09-11 23:32 +0200
  Re: Thread-ID - how much could be? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-12 11:29 +1000
    Re: Thread-ID - how much could be? Chris Angelico <rosuav@gmail.com> - 2014-09-12 11:49 +1000
    Re: Thread-ID - how much could be? Skip Montanaro <skip@pobox.com> - 2014-09-11 20:38 -0500
    Re: Thread-ID - how much could be? Cameron Simpson <cs@zip.com.au> - 2014-09-12 13:41 +1000
    Re: Thread-ID - how much could be? Chris Angelico <rosuav@gmail.com> - 2014-09-12 15:41 +1000
    Re: Thread-ID - how much could be? Ervin Hegedüs <airween@gmail.com> - 2014-09-12 08:30 +0200
    Re: Thread-ID - how much could be? dieter <dieter@handshake.de> - 2014-09-13 08:56 +0200
    Re: Thread-ID - how much could be? Peter Otten <__peter__@web.de> - 2014-09-13 09:48 +0200
    Re: Thread-ID - how much could be? Martin Skjöldebrand <shieldfire@gmail.com> - 2014-09-13 12:09 +0200
    Re: Thread-ID - how much could be? Ervin Hegedüs <airween@gmail.com> - 2014-09-13 12:32 +0200
  Re: Thread-ID - how much could be? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-09-16 10:53 +0200

csiph-web