-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
store thread.get_ident() thread identifier inside threading.Thread objects #47120
Comments
I've ran into a problem where it would be very nice to be able to tell Currently, when creating a new Thread object, there is no good way of I propose adding the get_ident() value as a publicly accessible field of |
Well, how about doing it at the beginning of its run() method, e.g. in a class MyThread(threading.Thread):
def run(self):
self.thread_ident = thread.get_ident()
threading.Thread.run(self) # or any other stuff Also, I don't think get_ident() is often useful when using the Threading |
Adding it in the run method would only work for threads that I create in And using the id() of the current thread object has a rather obscure |
Well, it's true that get_ident() will always give you a reliable number So finally your request sounds quite reasonable :-) |
This seems like a useful addition and is easy enough. Patch with tests and documentation attached. Unless I hear objections I Patch available for review here: http://codereview.appspot.com/1301 |
Thanks Gregory, for taking the time to make a patch. |
committed to trunk r63882 for inclusion in 2.6. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: