'Do I need to ensure ThreadPool threads have returned before exiting main (C++)
I cannot find a straight answer to this. I know that for ordinary threads that you create and control in C++, you must either join or detach them before exiting main. (http://www.cplusplus.com/forum/general/176290/)
But for thread pools (in which the programmer doesn't explicitly manage the threads), specifically with regard to the Win32 ThreadPool API(https://docs.microsoft.com/en-us/windows/win32/procthread/thread-pool-api): Do you have to ensure that no threads in the threadpool are running when the process terminates? And what happens if main exits while a worker thread callback is being executed in the threadpool created in main?
If one of the worker callbacks has an infinite loop, does that change anything?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
