Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timers In python
#1
Hi Everyone,

I am new to python,and wanted to Implement the Timer concept In python. I tried with threading module but don't know how to stop the Thread. And I am using only one thread very small piece of code but even after the parent process is closed the child process is running in the background.

Is there any other Implementation of Timer without using Thread module? Any help would be appreciated.

Thank you,
Shruthi LS
Reply
#2
Use multiprocessing module - it has the same API as the threading module, so that the switch will be painless. And a parent process can kill the spawned one
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#3
A multiprocessing Process can be terminated https://pymotw.com/3/multiprocessing/bas...-processes
Reply
#4
Ok thanks for the reply. But I don't have access for the event of closing the thread. Will the multiprocessing works in that way....
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Quick Help - Timers - Need Small Solution for Working Code EwH006 5 3,980 Nov-17-2020, 04:09 AM
Last Post: EwH006
  Multiple Timers SenselessScott 3 4,672 Jul-06-2020, 10:14 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020