Answer the question
In order to leave comments, you need to log in
How to interrupt a thread in python?
Good afternoon. Tell me how to stop the creation of new threads if at the time of the X thread the length of the list2 list has become> 0?
from multiprocessing.pool import ThreadPool
list_1=[1,2,3,4,5]
list2 =[]
def srch_1(ppp):
# тут некая логика при которой я добавляю запись в list2
p1 = ThreadPool(10)
for ppp in list_1:
p1.apply_async(srch_1, args=(ppp,))
p1.close()
p1.join()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question