Author ncoghlan
Recipients brett.cannon, eric.snow, grahamd, ncoghlan, serhiy.storchaka, steve.dower
Date 2016-12-30.14:20:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483107652.7.0.366584152343.issue29102@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-12-30 14:20:52ncoghlansetrecipients: + ncoghlan, brett.cannon, grahamd, eric.snow, serhiy.storchaka, steve.dower
2016-12-30 14:20:52ncoghlansetmessageid: <1483107652.7.0.366584152343.issue29102@psf.upfronthosting.co.za>
2016-12-30 14:20:52ncoghlanlinkissue29102 messages
2016-12-30 14:20:52ncoghlancreate