What is a good way to shutdown Threads blocked on NamedPipeServer#WaitForConnection?

后端 未结 7 2385
误落风尘
误落风尘 2020-12-01 10:02

I start my application which spawns a number of Threads, each of which creates a NamedPipeServer (.net 3.5 added managed types for Named Pipe IPC) and waits for clients to

7条回答
  •  温柔的废话
    2020-12-01 10:54

    One way that could work is checking for m_bShutdownRequested right after the WaitForConnection.

    During the shutdown process set the bool. After that send dummy messages to all the existing pipes so they open the connection and check the bool and shut down cleanly.

提交回复
热议问题