diff options
| author | Nils Maier <maierman@web.de> | 2013-08-17 23:04:15 +0200 |
|---|---|---|
| committer | Nils Maier <maierman@web.de> | 2013-08-18 06:04:20 +0200 |
| commit | 79fcafc31f593b4217657d4cd10effc832d7b7c3 (patch) | |
| tree | 21942df817054ebbe9ac4e830a1c82aed878ae59 /src/DownloadEngine.cc | |
| parent | 9e25335850c859ff54677807c7b8613414622917 (diff) | |
Win: Use SetConsoleCtrlHandler for SIGINT/SIGTERM
Diffstat (limited to 'src/DownloadEngine.cc')
| -rw-r--r-- | src/DownloadEngine.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index 348efa82..3b70364b 100644 --- a/src/DownloadEngine.cc +++ b/src/DownloadEngine.cc @@ -83,6 +83,7 @@ namespace global { // 2 ... stop signal processed by DownloadEngine // 3 ... 2nd stop signal(force shutdown) detected // 4 ... 2nd stop signal processed by DownloadEngine +// 5 ... main loop exited volatile sig_atomic_t globalHaltRequested = 0; } // namespace global @@ -141,6 +142,13 @@ void executeCommand(std::deque<std::unique_ptr<Command>>& commands, int DownloadEngine::run(bool oneshot) { + class GHR { + public: + ~GHR() { + global::globalHaltRequested = 5; + } + } ghr; + while(!commands_.empty() || !routineCommands_.empty()) { if(!commands_.empty()) { waitData(); |
