fatal-signal: Handle SIGINT for Windows.
authorGurucharan Shetty <gshetty@nicira.com>
Wed, 26 Feb 2014 17:37:19 +0000 (09:37 -0800)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 26 Feb 2014 20:40:11 +0000 (12:40 -0800)
commit0c10054023f8445ae698b650b4e901924a1cc194
treed8d5a919fdc63cdb59cb3443a46549378237af40
parenta19a3a9fc32f7a115e7e7bc6895355c10806d13b
fatal-signal: Handle SIGINT for Windows.

Ctrl+C signals are a special case for Windows and can
be handled by registering a handle through
SetConsoleCtrlHandler() routine. This is only useful
when we run it directly on console and not as services in
the background.

Once we get a Ctrl+C signal, we call the cleanup functions
and then exit.

One thing to know here is that MinGW terminal handles
Ctrl+C signal differently (and looks a little buggy. I see
it exiting the handler midway with some sort of timeout).
So this implementation is only useful when run on Windows
terminal. Since we only use MinGW for compilation and
eventually to run unit tests, it should be okay. (The unit
tests would ideally use windows services and not expect
Ctrl+C)

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