Message284332
It depends on the scope of uniqueness we're after. `threading._counter()` (which is the small-integer-ID debugging counter for threading.Thread names) is a module global in the threading module, so an Initialize/Finalize cycle will reset it. If we wanted to track "Which Initialize/Finalize cycle is this?" *as well*, it would make more sense to me to have that as a separate "runtime" counter, such that the full coordinates of the current point of execution were: - runtime counter (How many times has Py_Initialize been called?) - interpreter counter (Which interpreter is currently active?) - thread name (Which thread is currently active?) I'll also note that in the threading module, the main thread is implicitly thread 0 (but named as MainThread) - Thread-1 is the first thread created via threading.Thread. So it may make sense to use a signed numeric ID, with 0 being the main interpreter, 1 being the first subinterpreter, and negative IDs being errors. | |
| Date | User | Action | Args | | 2016-12-30 14:20:52 | ncoghlan | set | recipients: + ncoghlan, brett.cannon, grahamd, eric.snow, serhiy.storchaka, steve.dower | | 2016-12-30 14:20:52 | ncoghlan | set | messageid: <1483107652.7.0.366584152343.issue29102@psf.upfronthosting.co.za> | | 2016-12-30 14:20:52 | ncoghlan | link | issue29102 messages | | 2016-12-30 14:20:52 | ncoghlan | create | | |