0

I'm looking to create a thread pool mechanism which will limit the number of threads in the system in any given time. I have a several functions creating many threads and i want to create mutual thread pool for that.

From what i understood once a thread list is given to the future's threadpool it has to finish first since a 'with' statement must be used.

Can the futures module do that or do i have to write it myself?

MayaC
  • 61
  • 1
  • 7
  • You don't *need* to use a `with` statement to create a context manager: `ex = ThreadPoolExecutor(5)` will work just fine. – dano Jul 27 '15 at 04:06
  • So when do I have to use the with statement with this module? – MayaC Jul 28 '15 at 04:57
  • You don't ever *have* to. The with statement is used to guarantee that the pool will be shut down when you're done with it, but you're also able to manually call `ex.shutdown()` if the use-case calls for it. – dano Jul 28 '15 at 13:56

0 Answers0