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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 /** | 202 /** |
203 * Ordinary constructor. | 203 * Ordinary constructor. |
204 */ | 204 */ |
205 endsession_accumulator() | 205 endsession_accumulator() |
206 : permit_end_session( true ) | 206 : permit_end_session( true ) |
207 {} | 207 {} |
208 } ; | 208 } ; |
209 | 209 |
210 //------------------------------------------------------- | 210 //------------------------------------------------------- |
211 // Process_Closer | 211 // ProcessCloser |
212 //------------------------------------------------------- | 212 //------------------------------------------------------- |
213 /** | 213 /** |
214 * Shut down all the processes in the pid_list. | 214 * Shut down all the processes in the pid_list. |
215 * | 215 * |
216 * The method used here uses blocking system calls to send messages to target pro
cesses. | 216 * The method used here uses blocking system calls to send messages to target pro
cesses. |
217 * Message processing delays, therefore, are sequential and the total delay is th
eir sum. | 217 * Message processing delays, therefore, are sequential and the total delay is th
eir sum. |
218 * Windows has non-blocking message calls available, and using a multi-threaded i
mplementation would shorten that delay. | 218 * Windows has non-blocking message calls available, and using a multi-threaded i
mplementation would shorten that delay. |
219 * The code, hwoever, is significantly simpler without multi-threading. | 219 * The code, hwoever, is significantly simpler without multi-threading. |
220 * The present use of this method is not closing dozens of applications, so delay
performance is not critical. | 220 * The present use of this method is not closing dozens of applications, so delay
performance is not critical. |
221 * | 221 * |
222 * \return | 222 * \return |
223 * The negation of is_running. | 223 * The negation of is_running. |
224 * If is_running() was true at the beginning, then this function will have run
refresh() before returning. | 224 * If is_running() was true at the beginning, then this function will have run
refresh() before returning. |
225 * | 225 * |
226 * \sa | 226 * \sa |
227 * - MSDN [WM_QUERYENDSESSION message](http://msdn.microsoft.com/en-us/library/
windows/desktop/aa376890%28v=vs.85%29.aspx) | 227 * - MSDN [WM_QUERYENDSESSION message](http://msdn.microsoft.com/en-us/library/
windows/desktop/aa376890%28v=vs.85%29.aspx) |
228 * - MSDN [WM_ENDSESSION message](http://msdn.microsoft.com/en-us/library/windo
ws/desktop/aa376889%28v=vs.85%29.aspx) | 228 * - MSDN [WM_ENDSESSION message](http://msdn.microsoft.com/en-us/library/windo
ws/desktop/aa376889%28v=vs.85%29.aspx) |
229 */ | 229 */ |
230 bool Process_Closer::shut_down() | 230 bool ProcessCloser::shutDown() |
231 { | 231 { |
232 /* | 232 /* |
233 * If we're not running, we don't need to shut down. | 233 * If we're not running, we don't need to shut down. |
234 */ | 234 */ |
235 if ( ! is_running() ) | 235 if ( ! isRunning() ) |
236 { | 236 { |
237 return true ; | 237 return true ; |
238 } | 238 } |
239 | 239 |
240 /* | 240 /* |
241 * Shutting down is a structure as an escalating series of attempts to shut dow
n. | 241 * Shutting down is a structure as an escalating series of attempts to shut dow
n. |
242 * After each one, we wait to see if the shut down has completed. | 242 * After each one, we wait to see if the shut down has completed. |
243 * Even though we're using a blocking call to send messages, applications need
not block before exiting. | 243 * Even though we're using a blocking call to send messages, applications need
not block before exiting. |
244 * Internet Explorer, in particular, does not. | 244 * Internet Explorer, in particular, does not. |
245 * | 245 * |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 return false ; | 296 return false ; |
297 } | 297 } |
298 | 298 |
299 /* | 299 /* |
300 * Wait loop. | 300 * Wait loop. |
301 */ | 301 */ |
302 for ( unsigned int j = 0 ; j < 50 ; ++ j ) | 302 for ( unsigned int j = 0 ; j < 50 ; ++ j ) |
303 { | 303 { |
304 std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ) ; | 304 std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ) ; |
305 refresh() ; | 305 refresh() ; |
306 if ( ! is_running() ) | 306 if ( ! isRunning() ) |
307 { | 307 { |
308 return true ; | 308 return true ; |
309 } | 309 } |
310 } | 310 } |
311 // Assert is_running() | 311 // Assert is_running() |
312 } | 312 } |
313 // No control path leaves the for-loop. | 313 // No control path leaves the for-loop. |
314 } ; | 314 } ; |
315 | 315 |
OLD | NEW |