Skip to main content

terminate_thread

Project description

import threading
import time
from terminate_thread import terminate, kill


def thread_func1():
    n = 0
    while True:
        n += 1
        print(n, t)
        time.sleep(1)


if __name__ == "__main__":
    t = threading.Thread(target=thread_func1, )
    t.start()
    time.sleep(2)

    terminate(t)
    # or
    kill(t)

    exit(0)

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

terminate_thread-0.0.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

terminate_thread-0.0.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file terminate_thread-0.0.3.tar.gz.

File metadata

  • Download URL: terminate_thread-0.0.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.13

File hashes

Hashes for terminate_thread-0.0.3.tar.gz
Algorithm Hash digest
SHA256 be49c5c036b238275a06d9f5e918f93c2664803bb87d473316b33dbd67a87e84
MD5 944bfecd7770c8a5b991f38c8b6c6887
BLAKE2b-256 f810abb8568b0240baccd5bc32dde362d9b1d81026c0c6c519d72449b0f1fd3d

See more details on using hashes here.

File details

Details for the file terminate_thread-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for terminate_thread-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d9d4604d68ba2a7dba0a323f494015355a284014aaac72d13049fb7321a31b60
MD5 0fda75b72550321cbf62e1c4353e5c15
BLAKE2b-256 3ff9980e4be6158ca49bc3f3304afcdc4b15c2970975593b9b28a36d49edc769

See more details on using hashes here.

Supported by

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