[Python-checkins] python/dist/src/Lib threading.py,1.33,1.34
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Sun, 29 Jun 2003 09:58:43 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv24496/Lib
Modified Files:
threading.py
Log Message:
Add settrace() and setprofile() functions to the threading library.
Index: threading.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** threading.py 29 Jun 2003 16:50:06 -0000 1.33
--- threading.py 29 Jun 2003 16:58:41 -0000 1.34
***************
*** 53,56 ****
--- 53,68 ----
pass
+ # Support for profile and trace hooks
+
+ _profile_hook = None
+ _trace_hook = None
+
+ def setprofile(func):
+ global _profile_hook
+ _profile_hook = func
+
+ def settrace(func):
+ global _trace_hook
+ _trace_hook = func
# Synchronization classes
***************
*** 409,412 ****
--- 421,432 ----
if __debug__:
self._note("%s.__bootstrap(): thread started", self)
+
+ if _trace_hook:
+ self._note("%s.__bootstrap(): registering trace hook", self)
+ _sys.settrace(_trace_hook)
+ if _profile_hook:
+ self._note("%s.__bootstrap(): registering profile hook", self)
+ _sys.setprofile(_profile_hook)
+
try:
self.run()