fatal-signal: Fatal signal handling for Windows.
authorGurucharan Shetty <gshetty@nicira.com>
Wed, 26 Feb 2014 16:25:42 +0000 (08:25 -0800)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 26 Feb 2014 20:34:28 +0000 (12:34 -0800)
commit84a6cbae3684abe57733ea8e297eb5c63358908a
tree97b9713ef509609dd0cdf375ae48adaaf749e63e
parent278aa4c5c86b3b50102c3157ca5f7046dc2b4d8b
fatal-signal: Fatal signal handling for Windows.

Windows does not have a SIGHUP or SIGALRM. It does have
a SIGINT and SIGTERM. The documentation at msdn says that
SIGINT is not supported for win32 applications because
WIN32 operating systems generate a new thread to specifically
handle Ctrl+C.

This commit handles SIGTERM for Windows. The documentation also
states that nothing generates SIGTERM in Windows, but one can
use raise(SIGTERM) to manage it. The idea for handling SIGTERM
for Windows is to just have a place holder if there is need to
raise() a signal for some other purpose.

We use SIGALRM in timeval.c if we wake up from a sleep after
'deadline'. For Windows, print an error message and then
use SIGTERM.

There is an atexit() function for Windows, so we can call cleanup
functions during exit.

An upcoming commit separately handles Ctrl+C so that we can call
clean up functions for that use case.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/fatal-signal.c
lib/timeval.c