Is safe concurrent.futures.ThreadPoolExecutor in python?

Viewed 24

for a func that is not supported async, i will use the thread. it seems inefficient to create a new thread every time, i try to create a thread pool, and use it repeatedly while a program is running.

i kwnow that even if an error occurs by executing some func in thread "A", thread "A" can execute a different func.

however, what happens if the first func uses a global variable, and this affects the next func?

or, is there a case where 4 threads were created, but one died for some error and only three threads were used repeatedly?(except deadlock)

if such problem above accurs, is there a way to check the problem and refresh the thread of the thread pool?

0 Answers
Related