mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-24 10:23:02 -07:00
[Windows] Wait on a wall-clock 60 s deadline instead of a loop counter
This commit is contained in:
parent
38650b0c4e
commit
3bcb938289
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
|
; ask the application to close gracefully (WM_CLOSE), then wait for it to exit
|
||||||
DetailPrint "Closing $R1 ..."
|
DetailPrint "Closing $R1 ..."
|
||||||
Call CloseMatchingApps
|
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:
|
ck_wait_loop:
|
||||||
Sleep 500
|
Sleep 500
|
||||||
IntOp $R8 $R8 + 1
|
|
||||||
Call IsAppRunning
|
Call IsAppRunning
|
||||||
${If} $R0 = 0
|
${If} $R0 = 0
|
||||||
DetailPrint "$R1 closed."
|
DetailPrint "$R1 closed."
|
||||||
Return
|
Return
|
||||||
${EndIf}
|
${EndIf}
|
||||||
${If} $R8 < 60
|
${GetTickCount} $R9
|
||||||
|
IntOp $R9 $R9 - $R8
|
||||||
|
${If} $R9 < 60000
|
||||||
Goto ck_wait_loop
|
Goto ck_wait_loop
|
||||||
${EndIf}
|
${EndIf}
|
||||||
; give up waiting, force close
|
; give up waiting, force close
|
||||||
|
|
@ -366,16 +369,19 @@ Function un.WaitForAppToClose
|
||||||
${If} ${Silent}
|
${If} ${Silent}
|
||||||
DetailPrint "Closing $R1 ..."
|
DetailPrint "Closing $R1 ..."
|
||||||
Call un.CloseMatchingApps
|
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:
|
un_ck_wait_loop:
|
||||||
Sleep 500
|
Sleep 500
|
||||||
IntOp $R8 $R8 + 1
|
|
||||||
Call un.IsAppRunning
|
Call un.IsAppRunning
|
||||||
${If} $R0 = 0
|
${If} $R0 = 0
|
||||||
DetailPrint "$R1 closed."
|
DetailPrint "$R1 closed."
|
||||||
Return
|
Return
|
||||||
${EndIf}
|
${EndIf}
|
||||||
${If} $R8 < 60
|
${GetTickCount} $R9
|
||||||
|
IntOp $R9 $R9 - $R8
|
||||||
|
${If} $R9 < 60000
|
||||||
Goto un_ck_wait_loop
|
Goto un_ck_wait_loop
|
||||||
${EndIf}
|
${EndIf}
|
||||||
DetailPrint "Force closing $R1 ..."
|
DetailPrint "Force closing $R1 ..."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue