more windows fixes

This commit is contained in:
Joey Hess 2013-05-26 11:12:34 -04:00
parent b80d5494c4
commit 129be9cf68

View file

@ -13,12 +13,11 @@ module Utility.ThreadScheduler where
import Common import Common
import Control.Concurrent import Control.Concurrent
#ifndef __WINDOWS__
import System.Posix.Signals import System.Posix.Signals
#ifndef __ANDROID__ #ifndef __ANDROID__
#ifndef __WINDOWS__
import System.Posix.Terminal import System.Posix.Terminal
#endif #endif
#else
#endif #endif
newtype Seconds = Seconds { fromSeconds :: Int } newtype Seconds = Seconds { fromSeconds :: Int }
@ -55,17 +54,16 @@ unboundDelay time = do
waitForTermination :: IO () waitForTermination :: IO ()
waitForTermination = do waitForTermination = do
lock <- newEmptyMVar lock <- newEmptyMVar
#ifndef __WINDOWS__
let check sig lock = void $
installHandler sig (CatchOnce $ putMVar lock ()) Nothing
check softwareTermination lock check softwareTermination lock
#ifndef __ANDROID__ #ifndef __ANDROID__
#ifndef __WINDOWS__
whenM (queryTerminal stdInput) $ whenM (queryTerminal stdInput) $
check keyboardSignal lock check keyboardSignal lock
#endif #endif
#endif #endif
takeMVar lock takeMVar lock
where
check sig lock = void $
installHandler sig (CatchOnce $ putMVar lock ()) Nothing
oneSecond :: Microseconds oneSecond :: Microseconds
oneSecond = 1000000 oneSecond = 1000000