Apr-27-2025, 04:19 PM
I keep fixing the script after I ask for help its embarrassing
how do I delete a thread


how do I delete a thread
how to delete thread
|
Apr-27-2025, 04:19 PM
I keep fixing the script after I ask for help its embarrassing
![]() ![]() how do I delete a thread
Apr-27-2025, 05:10 PM
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Apr-27-2025, 07:25 PM
It's possible, but it is not exposed. It's not exposed, because it locks up the interpreter.
Here is a way to end a thread. The Event object is used, to communicate thread safe: import time from threading import Event, Thread, Timer def worker(event): while not event.is_set(): print("Ping") time.sleep(1) def main(): event = Event() worker_thread = Thread(target=worker, args=(event,)) worker_thread.start() # set event after 5 seconds Timer(5, event.set).start() # timer calls event.set() after 5 seconds if __name__ == "__main__": main()
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
OP asks how to delete thread here on the python forum
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Apr-28-2025, 07:30 PM
(Apr-28-2025, 08:08 AM)buran Wrote: OP asks how to delete thread here on the python forum So you can't delete threads at python-forum.io and threading.Thread doesn't allow you to delete/terminate threads either. I've been here for a while and realized that I've never needed this function.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians! |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Just Practicing Posting. Test Thread. “Sandbox” Thread. No Reply needed, Thanks | Doc_AElstein | 4 | 7,823 |
Dec-21-2017, 08:55 PM Last Post: micseydel |