When it is alive, an isAlive process takes the value of True but when that process ends what value does it take?
When I code if t.isAlive == True:
if it works because the process is alive
but when if t.isAlive == False:
does not do anything
I guess the process returns False
upon completion of the process
which is what I need to do x action.
Or is there another instruction or way of knowing when the process ends?
thanks
from threading import Timer
opcion = -1
def motor01():
print ("fin motor 1\n")
def motor02():
print ("fin motor 2\n")
while (opcion !=0 ):
opcion = int (input("opcion deseada "))
if opcion == 1:
t = Timer(10.0, motor01)
t.start() # after 30 seconds, "hello, world" will be printed
if t.isAlive()== False:
print ("realizar una acción cuando isAlive() detecte fin de proceso")
if opcion == 2:
t = Timer(10.0, motor02)
t.start() # after 30 seconds, "hello, world" will be printed
if t.isAlive() == False:
print ("realizar una acción cuando isAlive() detecte fin de proceso")