#ifndef mingw32_HOST_OS
import Data.Dynamic
-import Control.Monad
#endif
+import Control.Monad
import Data.Maybe
import GHC.Base
+#ifndef mingw32_HOST_OS
import GHC.Debug
+#endif
import {-# SOURCE #-} GHC.IO.Handle ( hFlush )
import {-# SOURCE #-} GHC.IO.Handle.FD ( stdout )
import GHC.IO
#endif
import GHC.Pack ( packCString# )
import GHC.Show ( Show(..), showString )
-import GHC.Err
infixr 0 `par`, `pseq`
\end{code}
startIOManagerThread :: IO ()
startIOManagerThread = do
wakeup <- c_getIOManagerEvent
- forkIO $ service_loop wakeup []
+ _ <- forkIO $ service_loop wakeup []
return ()
service_loop :: HANDLE -- read end of pipe
start_console_handler r =
case toWin32ConsoleEvent r of
Just x -> withMVar win32ConsoleHandler $ \handler -> do
- forkIO (handler x)
+ _ <- forkIO (handler x)
return ()
Nothing -> return ()
Just (f,_) -> do _ <- forkIO (f p_info)
return ()
+warnErrnoIfMinus1_ :: Num a => String -> IO a -> IO ()
+warnErrnoIfMinus1_ what io
+ = do r <- io
+ when (r == -1) $ do
+ errno <- getErrno
+ str <- strerror errno >>= peekCString
+ when (r == -1) $
+ debugErrLn ("Warning: " ++ what ++ " failed: " ++ str)
+
+foreign import ccall unsafe "string.h" strerror :: Errno -> IO (Ptr CChar)
+
foreign import ccall "setIOManagerPipe"
c_setIOManagerPipe :: CInt -> IO ()
#endif
-reportStackOverflow :: IO a
-reportStackOverflow = do callStackOverflowHook; return undefined
+reportStackOverflow :: IO ()
+reportStackOverflow = callStackOverflowHook
-reportError :: SomeException -> IO a
+reportError :: SomeException -> IO ()
reportError ex = do
handler <- getUncaughtExceptionHandler
handler ex
- return undefined
-- SUP: Are the hooks allowed to re-enter Haskell land? If so, remove
-- the unsafe below.
getUncaughtExceptionHandler :: IO (SomeException -> IO ())
getUncaughtExceptionHandler = readIORef uncaughtExceptionHandler
-warnErrnoIfMinus1_ :: Num a => String -> IO a -> IO ()
-warnErrnoIfMinus1_ what io
- = do r <- io
- when (r == -1) $ do
- errno <- getErrno
- str <- strerror errno >>= peekCString
- when (r == -1) $
- debugErrLn ("Warning: " ++ what ++ " failed: " ++ str)
-
-foreign import ccall unsafe "string.h" strerror :: Errno -> IO (Ptr CChar)
-
\end{code}