After looking at Python: Executing multiple functions simultaneously, I can successfully make two functions run simultaneously.
Is it possible to make two functions terminate simultaneously?
That is, given the following code:
from multiprocessing import Process
def func1:
while True:
# does something and breaks based on key-pressed condition
def func2:
while True:
# does something
if __name__=='__main__':
p1 = Process(target = func1)
p1.start()
p2 = Process(target = func2)
p2.start()
Can I make func2 terminate immediately after func1 finishes (upon the key-pressed condition being satisfied)?
Thanks in advance!