Am 30.08.2013 11:39, schrieb Antoine Pitrou: > > Le Fri, 30 Aug 2013 12:24:07 +0300, > Andrew Svetlov <andrew.svetlov at gmail.com> a écrit : >> Main thread is slightly different from others. >> Signals can be subscribed from main thread only. >> Tulip has special logic for main thread. >> In application code we can explicitly know which thread is executed, >> main or not. >> But from library it's not easy. >> Tulip uses check like >> threading.current_thread().name == 'MainThread' >> This approach has a problem: thread name is writable attribute and can >> be changed by user code. > > Please at least use: > > >>> isinstance(threading.current_thread(), threading._MainThread) > True > > But really, what we need is a threading.main_thread() function. What happens, when a program fork()s from another thread than the main thread? AFAIR the other threads are suspended and the forking thread is the new main thread. Or something similar... (Yes, I'm aware that threading + fork is an abomination.) Christian
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4