A singleton-based thread management system
Project description
Managed Threads
A singleton-based thread management system with auto-registration, verbose logging, and dynamic mixin support.
Quick Start
from toomanythreads import ManagedThread, manager
import time
# Simple function to run in a thread
def worker_function(name, delay=1):
for i in range(5):
print(f"Worker {name}: iteration {i}")
time.sleep(delay)
# Create and start a managed thread
thread = ManagedThread(worker_function)
thread.start()
# Check registered threads
print(f"Active threads: {len(manager.threads)}")
# Wait for completion
thread.join()
ManagedThread
A decorator/factory function that creates managed threads. Can be used as a decorator.
Parameters:
obj: Callable to run in the thread*args: Arguments to pass to the callable**kwargs: Keyword arguments to pass to the callable
Returns: Thread instance with management capabilities
Requirements
- Python 3.8+
- loguru >= 0.6.0
- singleton-decorator >= 1.0.0
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toomanythreads-0.2.78.tar.gz.
File metadata
- Download URL: toomanythreads-0.2.78.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
918c1e36bf0a27e8ca7d4f0af83ee77782a26255bca404aaf07b9490b3effdaf
|
|
| MD5 |
f97e068f2e148fa19759395857a2e55a
|
|
| BLAKE2b-256 |
8040c0bf0942a6cb2610e1d07dd4f8f3fb3dc45f41d5fb57256bc522cbadc5e2
|
File details
Details for the file toomanythreads-0.2.78-py3-none-any.whl.
File metadata
- Download URL: toomanythreads-0.2.78-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f46ca920e1da958201f9d2aaf1b29b3c1cbc06b2082f2aa1a14384352843be5
|
|
| MD5 |
bcb9591c6c2d63df27aa3c022c19fbb3
|
|
| BLAKE2b-256 |
29e08bfab103006d76159c3df1a83f1add90ece01b46d33254188483251c198f
|