Instructs all worker threads to terminate as soon as all tasks have been processed and waits for them to finish.
See Implementation
Instructs all worker threads to terminate as soon as all tasks have been processed and waits for them to finish.