[issue18882] Add threading.main_thread() function

Antoine Pitrou report at bugs.python.org
Fri Aug 30 14:47:11 CEST 2013


Antoine Pitrou added the comment:

> The function must take care of fork() in worker threads, too. The
> isinstance(current_thread(), _MainThread) trick may not work.

Well, there are two possibilities:
- main_thread() returns the original _MainThread instance, even if it's
  dead in the child process
- main_thread() returns the main thread of the current process

Both are reasonable, but we must settle for one :-)

(also, the use case of forking from a thread is really obscure, I don't
think we should worry too much about it)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18882>
_______________________________________


More information about the Python-bugs-list mailing list