Microsoft's PPL library contains powerful parallelisation concepts, and implements them using a thread pool, so no new threads are normally created when running PPL tasks. However, there doesn't seem to be a way to explicitly stop the threads in the thread pool.
The reason why I want to explicitly stop the threads is because of Qt. Some Qt methods store information in an allocated class instance, and a pointer to this class instance is stored in thread-local storage. This memory is only cleaned up if threads are stopped in a graceful way. If not, Qt cannot clean up this allocated memory.
Combining PPL with Qt implies that this memory is not decently deallocated at exit, which is not a problem in itself, but unfortunately this non-deallocated memory is reported as a memory leak by our memory allocation library (see Is anyone using valgrind and Qt? for a similar problem).
We noticed that if we create threads ourself (so not using the PPL thread pool), no leaks are reported. If we use PPL, leaks are reported.
So, the question: is there a way to explicitly stop the threads in the PPL thread pool?