mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-22 01:25:10 -07:00
[Windows] Wait on a wall-clock 60 s deadline instead of a loop counter
This commit is contained in:
parent
0f45ad9b46
commit
20229825f0
1 changed files with 12 additions and 6 deletions
|
|
@ -279,16 +279,19 @@ Function WaitForAppToClose
|
|||
; ask the application to close gracefully (WM_CLOSE), then wait for it to exit
|
||||
DetailPrint "Closing $R1 ..."
|
||||
Call CloseMatchingApps
|
||||
StrCpy $R8 0
|
||||
; wall-clock deadline: each poll has to spawn a fresh powershell.exe, so
|
||||
; a bare loop counter would not bound the real wait time to 60 s.
|
||||
${GetTickCount} $R8
|
||||
ck_wait_loop:
|
||||
Sleep 500
|
||||
IntOp $R8 $R8 + 1
|
||||
Call IsAppRunning
|
||||
${If} $R0 = 0
|
||||
DetailPrint "$R1 closed."
|
||||
Return
|
||||
${EndIf}
|
||||
${If} $R8 < 60
|
||||
${GetTickCount} $R9
|
||||
IntOp $R9 $R9 - $R8
|
||||
${If} $R9 < 60000
|
||||
Goto ck_wait_loop
|
||||
${EndIf}
|
||||
; give up waiting, force close
|
||||
|
|
@ -366,16 +369,19 @@ Function un.WaitForAppToClose
|
|||
${If} ${Silent}
|
||||
DetailPrint "Closing $R1 ..."
|
||||
Call un.CloseMatchingApps
|
||||
StrCpy $R8 0
|
||||
; wall-clock deadline: each poll has to spawn a fresh powershell.exe, so
|
||||
; a bare loop counter would not bound the real wait time to 60 s.
|
||||
${GetTickCount} $R8
|
||||
un_ck_wait_loop:
|
||||
Sleep 500
|
||||
IntOp $R8 $R8 + 1
|
||||
Call un.IsAppRunning
|
||||
${If} $R0 = 0
|
||||
DetailPrint "$R1 closed."
|
||||
Return
|
||||
${EndIf}
|
||||
${If} $R8 < 60
|
||||
${GetTickCount} $R9
|
||||
IntOp $R9 $R9 - $R8
|
||||
${If} $R9 < 60000
|
||||
Goto un_ck_wait_loop
|
||||
${EndIf}
|
||||
DetailPrint "Force closing $R1 ..."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue