As part of a windows service, I accept an incoming socket connection using
myListener.BeginAcceptSocket(acceptAsync, null)
The function acceptAsyncis executed in a separate thread (as expected).
When a service requests shutdown, I "signal" the streams that have been received and are currently working on sockets to complete.
After each thread ends, I need to block until they are executed. I have a list of topics that I thought I could scroll through and Joineach thread until they were executed.
Howerver seems that these threads do not end, but return to the pool, so Join will always wait.
How to block until a thread is returned to the pool?
source
share