How do I guarantee fast shutdown of my win32 app?

前端 未结 11 1858
夕颜
夕颜 2020-12-03 19:13

I\'ve got a C++ Win32 application that has a number of threads that might be busy doing IO (HTTP calls, etc) when the user wants to shutdown the application. Currently, I p

11条回答
  •  不知归路
    2020-12-03 19:29

    If you need to shutdown suddenly: Just call ExitProcess - which is what is going to be called just as soon as you return from WinMain anyway. Windows itself creates many worker threads that have no way to be cleaned up - they are terminated by process shutdown.

    If you have any threads that are performing writes of some kind - obviously those need a chance to close their resources. But anything else - ignore the bounds checker warnings and just pull the rug from under their feet.

提交回复
热议问题