Python Forum
Timers In python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Timers In python (/thread-10753.html)



Timers In python - ShruthiLS - Jun-05-2018

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


RE: Timers In python - volcano63 - Jun-05-2018

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


RE: Timers In python - woooee - Jun-06-2018

A multiprocessing Process can be terminated https://pymotw.com/3/multiprocessing/basics.html#terminating-processes


RE: Timers In python - ShruthiLS - Jun-11-2018

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....