I have a problem to start first thread, wait until end of first thread, start second thread, wait until finish of second thread and again go to first thread and do that in infinite loop.
The result I'm getting it's not working as it should because it's printing threads without time delay...
Here's my code:
import threading
import time
def Thread1():
while True:
print("THREAD 1")
time.sleep(3)
def Thread2():
while True:
print("THREAD 2")
time.sleep(6)
Thread1 = threading.Thread(target = Thread1)
Thread2 = threading.Thread(target = Thread2)
Thread1.start()
Thread2.start()
Thread2.join()
I want the result to be:
THREAD1
(3s pause)
THREAD2
(6s pause)
THREAD1
(3s pause)
THREAD2
(6s pause)
... (infinite loop)