Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Under POSIX OS there is signal API that allows to send a signal to process to shut it down with kill and you can catch it with sigaction and do what you need;

However, Win32 is not POSIX system, so:

  • How can I handle shutdown events that may come, for example from "End Process" in "Task manager"?
  • What is the standard API for sending shutdown signal to Win32 application?

I'm not talking about GUI, I'm talking about TCP/IP server that should be nicely shutdown. that does not run like windows service.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
655 views
Welcome To Ask or Share your Answers For Others

1 Answer

MSDNs Unix Code Migration Guide has a chapter about Win32 code conversion and signal handling.
Although Microsoft has decided to archive this brilliant guide, it is very useful.

Three methods are described:
Native signals
Event objects
Messages


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...