import time
from threading import Thread
def s_process():
print('***********************************************')
##time.sleep(2)
print('###############################################')
##time.sleep(2)
return
a = Thread(target=s_process)
while(True):
a.start()
a.join()
a.start()
a.join()
why is this code causing an error
***********************************************
###############################################
Traceback (most recent call last):
File "xxxxxxxxxxxxxxxxxxxxx", line 16, in <module>
a.start()
RuntimeError: threads can only be started once
shouldn't join() wait till the thread is finished. and if I have misunderstood how join() works how should I wait for the thread to finish without using a timeout