[issue42443] Provide Thread creation hook support

Christian Heimes report at bugs.python.org
Tue Nov 24 03:00:02 EST 2020


Christian Heimes <lists at cheimes.de> added the comment:

Besindes tests, PR also needs documentation and a better definition how and when the hook is called.

* IMO it should be called after profiling and tracing hook, so non-trivial hooks can be profiled and traced.
* It's important to define and document, which thread runs the hook (calling thread or new thread).
* Since the hook is designed to monitor thread creation, would it make sense to pass the thread object to the hook?
* How does the hook behave when the callback raises an exception?
* Is a single hook good enough or should the API behave more like atexit, which supports an abitrary amount of hooks?
* Instead of just a creation hook, how about lifetime hooks are also called when a thread ends?

----------
nosy: +christian.heimes

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42443>
_______________________________________


More information about the Python-bugs-list mailing list