| Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 1 #include <stdexcept> | 1 #include <stdexcept> | 
| 2 #include <functional> | 2 #include <functional> | 
| 3 #include <wctype.h> | 3 #include <wctype.h> | 
| 4 // <thread> is C++11, but implemented in VS2012 | 4 // <thread> is C++11, but implemented in VS2012 | 
| 5 #include <thread> | 5 #include <thread> | 
| 6 | 6 | 
| 7 #include "installer-lib.h" | 7 #include "installer-lib.h" | 
| 8 #include "process.h" | 8 #include "process.h" | 
| 9 #include "handle.h" | 9 #include "handle.h" | 
| 10 #include "session.h" | 10 #include "session.h" | 
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 case 3 : | 271 case 3 : | 
| 272 { | 272 { | 
| 273 /* | 273 /* | 
| 274 * Send WM_CLOSE to every admissible window. | 274 * Send WM_CLOSE to every admissible window. | 
| 275 */ | 275 */ | 
| 276 send_message m( WM_CLOSE, 0, 0 ) ; | 276 send_message m( WM_CLOSE, 0, 0 ) ; | 
| 277 iterate_our_windows( m ) ; | 277 iterate_our_windows( m ) ; | 
| 278 } | 278 } | 
| 279 break ; | 279 break ; | 
| 280 | 280 | 
| 281 default : | 281 default : | 
| 
 
Eric
2015/03/13 16:49:48
This should be "case 4 :" and we should retain the
 
 | |
| 282 /* | 282 /* | 
| 283 * We're out of ways to try to shut down. | 283 * We're out of ways to try to shut down. Oh well. Take cover. It gets viol ent here. | 
| 
 
Eric
2015/03/13 16:49:48
Good comment.
 
 | |
| 284 */ | 284 */ | 
| 285 return false ; | 285 for (auto it = pid_set.begin(); it != pid_set.end(); ++it) | 
| 286 { | |
| 287 HANDLE tmpHandle = OpenProcess(PROCESS_TERMINATE, FALSE, *it); | |
| 288 if (tmpHandle != NULL) | |
| 
 
Eric
2015/03/13 16:49:48
We can use implicit conversion to bool here.
I wo
 
 | |
| 289 { | |
| 290 Windows_Handle procHandle(tmpHandle); | |
| 291 TerminateProcess(tmpHandle, 0); | |
| 292 } | |
| 293 } | |
| 294 Refresh(); | |
| 295 | |
| 296 return !IsRunning() ; | |
| 286 } | 297 } | 
| 287 | 298 | 
| 288 /* | 299 /* | 
| 289 * Wait loop. | 300 * Wait loop. | 
| 290 */ | 301 */ | 
| 291 for ( unsigned int j = 0 ; j < 50 ; ++ j ) | 302 for ( unsigned int j = 0 ; j < 50 ; ++ j ) | 
| 292 { | 303 { | 
| 293 std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ) ; | 304 std::this_thread::sleep_for( std::chrono::milliseconds( 30 ) ) ; | 
| 
 
sergei
2015/04/02 08:04:09
no spaces?
 
 | |
| 294 Refresh() ; | 305 Refresh() ; | 
| 295 if ( ! IsRunning() ) | 306 if ( ! IsRunning() ) | 
| 296 { | 307 { | 
| 297 return true ; | 308 return true ; | 
| 298 } | 309 } | 
| 299 } | 310 } | 
| 300 // Assert is_running() | 311 // Assert is_running() | 
| 301 } | 312 } | 
| 302 // No control path leaves the for-loop. | 313 // No control path leaves the for-loop. | 
| 303 } ; | 314 } ; | 
| 304 | 315 | 
| OLD | NEW |