I am currently using python concurrent.futures to add threading to my function.
I want to kill all threads and continue down the program (or exit out if there is nothing else to do) if 1 thread of the pool matches a condition. All other threads in the pool should stop (either abruptly or gracefully)
import concurrent.futures
import random
def randomizer(number):
print("Randomized: "+str(number+random.randrange(0,10)))
if some_case:
allthreads.kill() # This is obviously non working code
if __name__ == '__main__':
numbers=[5,4,3,2,1,0]
with concurrent.futures.ThreadPoolExecutor() as executor:
executor.map(randomizer, numbers)