On this page
threading.main_thread
Prev: threading.Lock | Up: threading | Next: threading.RLock
Rel: threading.active_count, threading.Barrier, threading.BoundedSemaphore, threading.BrokenBarrierError
Ref: docs.python.org — threading.main_thread
Tags: #public #python3 #stdlib #threading
Import
import threading
from threading import main_thread
Signature & Overview
threading.main_thread()
Return the main thread object.
Usage
import threading
assert threading.current_thread() is threading.main_thread()
Gotchas
- Signal handlers & GUI loops require the main thread: Check
threading.current_thread() is threading.main_thread()before registeringsignal.signal().
REPL Inspect
from threading import main_thread
help(main_thread)
Linked from
Related notes
- tuts/python3/stdlib_module/threading/Lock Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/RLock 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