Answer the question
In order to leave comments, you need to log in
How to take data from an array in multiple threads?
Hello. Need help with multithreading. I have a list with objects, each object will have its own tasks that need to be done. There will be a function that will run in several threads, and an object from the list will be passed to it. And this function will determine what to do with it next. Tell me how to take objects from an array in several threads?
Answer the question
In order to leave comments, you need to log in
from concurrent.futures import ThreadPoolExecutor
with ThreadPoolExecutor(max_workers=NUM_WORKERS) as executor:
results = executor.map(fn, list_of_objects)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question