avoid blocked indefinitely on mvar on windows
by repeatedly reading lines and pausing since cannot do signal foo used on unix
This commit is contained in:
parent
4ebb35dc59
commit
abb0b3103f
1 changed files with 5 additions and 2 deletions
|
@ -53,17 +53,20 @@ unboundDelay time = do
|
|||
{- Pauses the main thread, letting children run until program termination. -}
|
||||
waitForTermination :: IO ()
|
||||
waitForTermination = do
|
||||
#ifdef mingw32_HOST_OS
|
||||
runEvery (Seconds 600) $
|
||||
void getLine
|
||||
#else
|
||||
lock <- newEmptyMVar
|
||||
#ifndef mingw32_HOST_OS
|
||||
let check sig = void $
|
||||
installHandler sig (CatchOnce $ putMVar lock ()) Nothing
|
||||
check softwareTermination
|
||||
#ifndef __ANDROID__
|
||||
whenM (queryTerminal stdInput) $
|
||||
check keyboardSignal
|
||||
#endif
|
||||
#endif
|
||||
takeMVar lock
|
||||
#endif
|
||||
|
||||
oneSecond :: Microseconds
|
||||
oneSecond = 1000000
|
||||
|
|
Loading…
Add table
Reference in a new issue