On this page
threading.active_count
Up: threading | Next: threading.Barrier
Rel: threading.Barrier, threading.BoundedSemaphore, threading.BrokenBarrierError, threading.Condition
Ref: docs.python.org — threading.active_count
Tags: #public #python3 #stdlib #threading
Import
import threading
from threading import active_count
Signature & Overview
threading.active_count()
Return the number of Thread objects currently alive.
Usage
import threading
assert threading.active_count() >= 1
Gotchas
- Matches
len(threading.enumerate()): Includes the main thread and any alive daemon/non-daemon threads.
REPL Inspect
from threading import active_count
help(active_count)
Linked from
- tuts/python3/stdlib_module/threading
- tuts/python3/stdlib_module/threading/Barrier
- tuts/python3/stdlib_module/threading/BoundedSemaphore
- tuts/python3/stdlib_module/threading/BrokenBarrierError
- tuts/python3/stdlib_module/threading/Condition
- tuts/python3/stdlib_module/threading/current_thread
- tuts/python3/stdlib_module/threading/enumerate
- tuts/python3/stdlib_module/threading/Event
- tuts/python3/stdlib_module/threading/excepthook
- tuts/python3/stdlib_module/threading/ExceptHookArgs
- tuts/python3/stdlib_module/threading/get_ident
- tuts/python3/stdlib_module/threading/get_native_id
- tuts/python3/stdlib_module/threading/getprofile
- tuts/python3/stdlib_module/threading/gettrace
- tuts/python3/stdlib_module/threading/local
- tuts/python3/stdlib_module/threading/Lock
- tuts/python3/stdlib_module/threading/main_thread
- tuts/python3/stdlib_module/threading/RLock
- tuts/python3/stdlib_module/threading/Semaphore
- tuts/python3/stdlib_module/threading/setprofile
- tuts/python3/stdlib_module/threading/setprofile_all_threads
- tuts/python3/stdlib_module/threading/settrace
- tuts/python3/stdlib_module/threading/settrace_all_threads
- tuts/python3/stdlib_module/threading/stack_size
- tuts/python3/stdlib_module/threading/Thread
- tuts/python3/stdlib_module/threading/ThreadError
- tuts/python3/stdlib_module/threading/Timer
Related notes
- tuts/python3/stdlib_module/threading/Barrier Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/BoundedSemaphore Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/BrokenBarrierError Linked here; links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Condition 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/current_thread links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/enumerate links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/Event links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/excepthook links to this page; shared tags: #stdlib, #threading
- tuts/python3/stdlib_module/threading/ExceptHookArgs links to this page; shared tags: #stdlib, #threading