Skip to content

calm51/terminate_thread

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors