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

Antoine Pitrou solipsis at pitrou.net
Fri Aug 30 11:43:20 CEST 2013


Le Fri, 30 Aug 2013 11:36:57 +0200,
Victor Stinner <victor.stinner at gmail.com> a écrit :
> 
> If we expose the identifier of the main thread, something should be
> added to the threading module, not the signal module.

Agreed.

> Is it possible that the main thread exit while there are still other
> live threads?

"exit" in what sense? In the C sense, no: when the main C thread
exits, the whole process is terminated (this is how our "daemon threads"
work).

In the Python sense, yes: we have a test for it:
http://hg.python.org/cpython/file/c347b9063a9e/Lib/test/test_threading.py#l325

Regards

Antoine.




More information about the Python-Dev mailing list