Kill Thread
只有一个功能,杀死线程!
安装
pip install kill-thread
示例
import time
import datetime
import threading
from kill_thread import kill_thread
def print_time():
while True:
time.sleep(1)
print(datetime.datetime.now())
# 生成启动一个每隔一秒打印当前时间的线程
thread = threading.Thread(target=print_time)
thread.start()
# 十秒后杀死线程
time.sleep(10)
kill_thread(thread)
# 阻塞主线程观察打印时间的线程是否被杀死
input('按任意键终止主线程')
Metadata
Release files for kill-thread 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kill-thread-0.0.1.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kill_thread-0.0.1-py3.9.egg | Legacy Egg format | - | - | Details |
Total release size: 8.4 kB
Release files / kill-thread-0.0.1.tar.gz
| Download URL | kill-thread-0.0.1.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98dc45a75b91c10009787ae4ac3b0f047b17a00d65b93aaf58fce9fcf5b0b099
|
|
BLAKE2b-256 checksum How to use checksums |
71e16f514431582fc045dbcea8d3ffae2c5de86e6a82eb3ec9aba940bdfff5a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.9
|
Release files / kill_thread-0.0.1-py3.9.egg
| Download URL | kill_thread-0.0.1-py3.9.egg |
|---|---|
| Size | 2.2 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
b56e22ff058747a4c75df658966eaa6af5fba44f81b279c973939c00e289d185
|
|
BLAKE2b-256 checksum How to use checksums |
edae79271f503fbc3d3acac3052828695a8102911fbb0a5631b489d61664b403
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.9
|