Message358362
The threading module has a "main_thread()" function that returns a Thread instance for the "main" thread. The main thread is the one running when the runtime is initialized and has a specific role in various parts of the runtime. Currently the threading module instead uses the ID of the thread where the module is imported for the first time. Usually this isn't a problem. (perhaps only in embedding cases?)
Since 3.8 we store the ID of the thread where the runtime was initialized (_PyRuntime.main_thread). By using this in the threading module we can be consistent across the runtime about what the main thread is.
This is particularly significant because in 3.8 we also updated the signal module to use _PyRuntime.main_thread (instead of calling PyThread_get_thread_ident() when the module is loaded). See issue38904.
We should also consider backporting this change to 3.8, to resolve the difference between the threading and signal modules. |
|
Date |
User |
Action |
Args |
2019-12-13 22:21:22 | eric.snow | set | recipients:
+ eric.snow |
2019-12-13 22:21:22 | eric.snow | set | messageid: <1576275682.19.0.998306709118.issue39042@roundup.psfhosted.org> |
2019-12-13 22:21:22 | eric.snow | link | issue39042 messages |
2019-12-13 22:21:21 | eric.snow | create | |
|