A windows service has an open socket that is receiving data (on a separate thread)
In response to the service OnShutdown
I would like to signal worker thread to shutdown, but it's currently blocked on the Receive
.
At the moment I'm timing out on the Receive
to check if there is a stop request pending. Is there a better approach, rather than waiting on the timeout to notify the worker thread to stop receiving and go through its shutdown logic?