Python multithread functions
I've got a python function and want to run it in multithreading mode. How can I do it?
I've got a python function and want to run it in multithreading mode. How can I do it?
There are couple of ways you can do that. One of them is the following
import threading
threads = []
tr = threading.Thread(target=my_func, args=(arg1, arg2, etc))
threads.append(tr)
tr.start()
for tr in threads:
tr.join()
Just define my_func function and put the correct list of arguments.