Home > front end >  ThreadPoolExecutor: Not executing in parallel
ThreadPoolExecutor: Not executing in parallel

Time:01-30

I did follow the other SO threads but I am not able to figure this out.

max_thread = 40
def main():
    variable_name = 1
    with concurrent.futures.ThreadPoolExecutor(max_workers=max_thread) as executor:
        futures = []
        for i in range(5):
            if count < max_count:
                futures.append(executor.submit(thread_function, xx, yy, zz))
            for future in concurrent.futures.as_completed(futures):
                future.result()
        print("Main done with it")

CodePudding user response:

Made a small mistake . lol reduced indent for this section.

for future in concurrent.futures.as_completed(futures):
    future.result()
  • Related