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. -}
|
{- Pauses the main thread, letting children run until program termination. -}
|
||||||
waitForTermination :: IO ()
|
waitForTermination :: IO ()
|
||||||
waitForTermination = do
|
waitForTermination = do
|
||||||
|
#ifdef mingw32_HOST_OS
|
||||||
|
runEvery (Seconds 600) $
|
||||||
|
void getLine
|
||||||
|
#else
|
||||||
lock <- newEmptyMVar
|
lock <- newEmptyMVar
|
||||||
#ifndef mingw32_HOST_OS
|
|
||||||
let check sig = void $
|
let check sig = void $
|
||||||
installHandler sig (CatchOnce $ putMVar lock ()) Nothing
|
installHandler sig (CatchOnce $ putMVar lock ()) Nothing
|
||||||
check softwareTermination
|
check softwareTermination
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
whenM (queryTerminal stdInput) $
|
whenM (queryTerminal stdInput) $
|
||||||
check keyboardSignal
|
check keyboardSignal
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
takeMVar lock
|
takeMVar lock
|
||||||
|
#endif
|
||||||
|
|
||||||
oneSecond :: Microseconds
|
oneSecond :: Microseconds
|
||||||
oneSecond = 1000000
|
oneSecond = 1000000
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue