J
J
jslby2020-06-16 06:25:21
Python
jslby, 2020-06-16 06:25:21

How to run a function in multithread?

Hello.
For the first time I encountered multithreading. Tell me, how can I run 10 threads per 1 function?
The function does not work with external variables, no locks are needed.
The problem is that I don’t know how to correctly close the stream at the end of the program, but start the execution of the function again on a new one, or it would be better to close the stream and open a new one again to clear the memory.
Please advise how to implement this. Thanks a lot

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-06-16
@jslby

https://docs.python.org/3/library/threading.html
https://docs.python.org/3/library/concurrent.futur...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question