Source Code:
(back to article)
import threading import time def my_function(): print("Thread is running") time.sleep(10) print("Thread is done") my_thread = threading.Thread(target=my_function) my_thread.start() my_thread.join(5) print("Thread is killed")
Result:
Report an issue