Skip to main content

只有一个功能,杀死线程!

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kill_thread-0.0.1-py3.9.egg (2.2 kB view details)

Uploaded Egg

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

Hashes for kill-thread-0.0.1.tar.gz
Algorithm Hash digest
SHA256 98dc45a75b91c10009787ae4ac3b0f047b17a00d65b93aaf58fce9fcf5b0b099
MD5 d7617ad39ebda5dfe50c86121c81ec79
BLAKE2b-256 71e16f514431582fc045dbcea8d3ffae2c5de86e6a82eb3ec9aba940bdfff5a2

See more details on using hashes here.

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

Hashes for kill_thread-0.0.1-py3.9.egg
Algorithm Hash digest
SHA256 b56e22ff058747a4c75df658966eaa6af5fba44f81b279c973939c00e289d185
MD5 a6b2966cd7b9fac0887db8c9b76b3b1a
BLAKE2b-256 edae79271f503fbc3d3acac3052828695a8102911fbb0a5631b489d61664b403

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page