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


Groups > comp.lang.python > #77839

Re: Thread-ID - how much could be?

From Peter Otten <__peter__@web.de>
Subject Re: Thread-ID - how much could be?
Date 2014-09-13 09:48 +0200
Organization None
References (1 earlier) <lusua3$a4t$1@ger.gmane.org> <mailman.13944.1410471154.18130.python-list@python.org> <54124c95$0$29991$c3e8da3$5496439d@news.astraweb.com> <20140912063041.GC3333@arxnet.hu> <87k3582ely.fsf@handshake.de>
Newsgroups comp.lang.python
Message-ID <mailman.13994.1410594501.18130.python-list@python.org> (permalink)

Show all headers | View raw


dieter wrote:

> Ervin Hegedüs <airween@gmail.com> writes:
>> ...
> What is used as thread id is platform dependent. Likely, it depends
> on the thread support of the underlying C libary (i.e. the
> operating system thread support).
> 
> Under Linux, thread ids seem to be addresses - i.e. very large
> integers.

$ grep "Exception in thread" /usr/lib/python3.4/threading.py 
                    _sys.stderr.write("Exception in thread %s:\n%s\n" %
                            "Exception in thread " + self.name +


I believe the "Thread-ID"s we are talking about are actually user-specified 
names attached Python's threading.Thread instances, not something on the OS 
level. These names default to

$ grep -i -A4 -B1 "def _newname" /usr/lib/python3.4/threading.py
_counter = 0
def _newname(template="Thread-%d"):
    global _counter
    _counter += 1
    return template % _counter


Back to comp.lang.python | Previous | NextPrevious in thread | Next 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