As mentioned I the title. I am using Python 2.7 in the Spyder IDE. My problem is that in my loop all the threads get started at once...this kills my pc. Thats why I only want 2 of them at a time. I understood that join waits for the thread to finish? did I misunderstood that?
def func1(string):
subprocess.Popen(string , shell= True)
for i in range(0,A):
j = 0
check = False
tl=[]
while j <= B :
string = 'python do.py'+ ' '+str(i)+' '+str( j)+' '+ str( 3)
t = threading.Thread(target=func1,args=[string])
t.start()
tl.append(t)
string = 'python do.py'+ ' '+str(i)+' '+str( j)+' '+ str( 3)
t = threading.Thread(target=func1,args=[string])
t.start()
tl.append(t)
for t in tl:
t.join()