encounters the same problem, the while True in the method called by the
thread cannot jump out of the thread ending the while loop outside the while
def startsendfile(self,filelist,taskpath,filetypepath):
for k in range(2):
-sharp new_thread = threading.Thread(target=self.booth(k,filelist,taskpath,filetypepath))
new_thread = threading.Thread(target=self.booth,args=(k,filelist,taskpath,filetypepath))
-sharp new_thread.setDaemon(True)
self.thread_list.append(new_thread)
for t in self.thread_list:
t.start()
for t in self.thread_list:
t.join()
print("", time_now())
Thread calls methods
def booth(self,tid, filelist,taskpath,filetypepath):
global thread_data_num
global lock
while True:
self.lock.acquire()
print(self.thread_data_num)
if self.thread_data_num != 0:
self.thread_data_num = self.thread_data_num - 1
item = filelist[self.thread_data_num]
time.sleep(10)
else:
break
self.lock.release()
print("")
is the result printed = > is it out
but does not print = > all threads end