[Python-Dev] Add function to signal module for getting main thread id

Antoine Pitrou solipsis at pitrou.net
Fri Aug 30 14:18:44 CEST 2013


Le Fri, 30 Aug 2013 22:09:37 +1000,
Nick Coghlan <ncoghlan at gmail.com> a écrit :
> On 30 August 2013 20:27, Andrew Svetlov <andrew.svetlov at gmail.com>
> wrote:
> > I've filed http://bugs.python.org/issue18882 for this.
> 
> I don't actually object to the addition, but is there any way that
> "threading.enumerate()[0]" *won't* be the main thread?

enumerate() doesn't guarantee any ordering, and the underlying
container is a dict (actually, there are two of them).

> (subinterpreters, perhaps, but they're going to have trouble anyway,
> since they won't have access to the real main thread)

Ah, subinterpreters :-)

cheers

Antoine.




More information about the Python-Dev mailing list