tatsuhiro-t/aria2 — pull request #117 by nmaier (2013-08-18 04:19:16+00:00)
Title: Fix Windows CTRL-C behavior (SIGINT + SIGTERM)

signal handling on windows is very unreliable, and may not accept multiple CTRL-C hits, or no CTRL-C hits at all in some environments (native executable under cygwin).

By switching to the Windows-own `SetConsoleCtrlHandler` this is rectified. However, this adds some complexity as well, because the "signals" will now be dispatched to another thread.

I also added a simple Lock implementation, which, as the commit message correctly states, is a no-op on platforms other than Windows. This isn't a problem, though, as the only code using it now is only potentially multi-threaded on Windows.