Python thread control, using ctypes to achieve forcibly terminating a thread even if it is still running.
Project description
tdmgm
python线程控制,使用ctypes实现即时线程还在运行中,也可以强行终止线程运行。
特性
- 线程控制工具类
- 支持循环线程和一次性线程
- 便捷的线程管理与结果获取
安装
推荐使用 pip 安装(需先打包或上传到 PyPI):
pip install tdmgm
或直接在本地项目中使用:
git clone https://github.com/zaixia108/ThreadControl.git
cd ThreadControl
pip install .
目录结构
tdmgm/
├── __init__.py
├── CycleThread.py
├── OnceThread.py
├── thread_utils.py
快速上手
from tdmgm.CycleThread import CycleThread
from tdmgm.OnceThread import OnceThread
def my_task():
print("线程任务执行中")
# 循环线程示例
cycle = CycleThread(target=my_task, name="循环线程")
cycle.start()
# 一次性线程示例
once = OnceThread(target=my_task, name="一次性线程")
once.start()
许可证
MIT License
作者
zaixia108
邮箱: xvbowen2012@gmail.com
项目主页
https://github.com/zaixia108/ThreadControl
此文件保存为 `README.md`,放在项目根目录即可。
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
tdmgm-0.0.1.tar.gz
(7.1 kB
view details)
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
tdmgm-0.0.1-py3-none-any.whl
(9.0 kB
view details)
File details
Details for the file tdmgm-0.0.1.tar.gz.
File metadata
- Download URL: tdmgm-0.0.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70173cb8343695b1516195f58dc398d8e504a61beba8401925b5fc383d5375ae
|
|
| MD5 |
c543a3631dda0bea6b3a634484ea8dd3
|
|
| BLAKE2b-256 |
35b47889285c846135ff5a06ed7f6c4113de35154df7e7f32100d7b1a7566aca
|
File details
Details for the file tdmgm-0.0.1-py3-none-any.whl.
File metadata
- Download URL: tdmgm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee90299c5dcd658ce4a04e5b8539d66d1fc19ce8460806144a69bc968ab48ea4
|
|
| MD5 |
7e85862002f35b499049ebaae6e733dd
|
|
| BLAKE2b-256 |
3d9a777c926865af22b270c9056164d3bc1d940fdf4ba89f8f8e2735f428688c
|