The Windows service has an open socket that accepts data (in a separate stream).
In response to the OnShutdown service OnShutdown I would like to signal a worker thread to shutdown, but it is currently blocked on Receive .
I'm currently disabling Receive to check if a stop request is waiting. Is there a better approach, rather than waiting for a timeout, to notify the worker thread to stop receiving and go through its shutdown logic?
source share