Provides an easy way to manage a pool of threads and submit and reap tasks run by those threads.
Generation of random numbers (known count):
- pool of 5 threads available to run tasks
- 100 tasks queued up
- all 100 tasks are expected and reaped
Generation of random numbers (unknown count):
tp.drain()may interrupt the processing of tasks so that the number of completed tasks is not known
tp.is_empty()checks for waiting, running, and done tasks