On this page
threading.settrace
Prev: threading.setprofile_all_threads | Up: threading | Next: threading.settrace_all_threads
Rel: threading.active_count, threading.Barrier, threading.BoundedSemaphore, threading.BrokenBarrierError
Ref: docs.python.org — threading.settrace
Tags: #public #python3 #stdlib #threading
Import
import threading
from threading import settrace
Signature & Overview
threading.settrace(func)
Set a trace function for all threads started from the threading module.
Usage
import threading
# Registers a trace function for all *future* Thread objects started via threading
threading.settrace(None)
Gotchas
- Only applies to newly started threads: Use
settrace_all_threads()(Python 3.12+) to trace threads already running.
REPL Inspect
from threading import settrace
help(settrace)
Linked from
Related notes
- tuts/python3/stdlib_module/threading/setprofile_all_threads Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/settrace_all_threads Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/threading/active_count Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Barrier Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/BoundedSemaphore Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/BrokenBarrierError Linked here; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Condition shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/current_thread shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/enumerate shared tags: #stdlib, #threading