只有一个功能,杀死线程!
Project description
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('按任意键终止主线程')
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
kill-thread-0.0.1.tar.gz
(6.2 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
kill_thread-0.0.1-py3.9.egg
(2.2 kB
view details)
File details
Details for the file kill-thread-0.0.1.tar.gz.
File metadata
- Download URL: kill-thread-0.0.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98dc45a75b91c10009787ae4ac3b0f047b17a00d65b93aaf58fce9fcf5b0b099
|
|
| MD5 |
d7617ad39ebda5dfe50c86121c81ec79
|
|
| BLAKE2b-256 |
71e16f514431582fc045dbcea8d3ffae2c5de86e6a82eb3ec9aba940bdfff5a2
|
File details
Details for the file kill_thread-0.0.1-py3.9.egg.
File metadata
- Download URL: kill_thread-0.0.1-py3.9.egg
- Upload date:
- Size: 2.2 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b56e22ff058747a4c75df658966eaa6af5fba44f81b279c973939c00e289d185
|
|
| MD5 |
a6b2966cd7b9fac0887db8c9b76b3b1a
|
|
| BLAKE2b-256 |
edae79271f503fbc3d3acac3052828695a8102911fbb0a5631b489d61664b403
|