X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FConc.lhs;h=7f7d585d22a6b1db8b8f5ba36492e370b38484b8;hb=c72dc997c63a629f6a2a9f82168ac93dda9ee09e;hp=d1528158d09f24f5058e3ec1be1e5b4f98629b6d;hpb=393de16f52b373eb9d2a7c69509881bf5aa7b912;p=ghc-base.git diff --git a/GHC/Conc.lhs b/GHC/Conc.lhs index d152815..7f7d585 100644 --- a/GHC/Conc.lhs +++ b/GHC/Conc.lhs @@ -110,12 +110,14 @@ import Data.Typeable #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 @@ -139,7 +141,6 @@ import GHC.Enum ( Enum ) #endif import GHC.Pack ( packCString# ) import GHC.Show ( Show(..), showString ) -import GHC.Err infixr 0 `par`, `pseq` \end{code} @@ -264,9 +265,9 @@ real_handler :: SomeException -> IO () real_handler se@(SomeException ex) = -- ignore thread GC and killThread exceptions: case cast ex of - Just BlockedOnDeadMVar -> return () + Just BlockedIndefinitelyOnMVar -> return () _ -> case cast ex of - Just BlockedIndefinitely -> return () + Just BlockedIndefinitelyOnSTM -> return () _ -> case cast ex of Just ThreadKilled -> return () _ -> case cast ex of @@ -822,7 +823,7 @@ prodServiceThread = do startIOManagerThread :: IO () startIOManagerThread = do wakeup <- c_getIOManagerEvent - forkIO $ service_loop wakeup [] + _ <- forkIO $ service_loop wakeup [] return () service_loop :: HANDLE -- read end of pipe @@ -876,7 +877,7 @@ start_console_handler :: Word32 -> IO () start_console_handler r = case toWin32ConsoleEvent r of Just x -> withMVar win32ConsoleHandler $ \handler -> do - forkIO (handler x) + _ <- forkIO (handler x) return () Nothing -> return () @@ -1107,6 +1108,17 @@ runHandlers' p_info sig = do 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 () @@ -1239,7 +1251,7 @@ foreign import ccall unsafe "setTimevalTicks" data CFdSet -foreign import ccall safe "select" +foreign import ccall safe "__hscore_select" c_select :: CInt -> Ptr CFdSet -> Ptr CFdSet -> Ptr CFdSet -> Ptr CTimeVal -> IO CInt @@ -1269,8 +1281,8 @@ foreign import ccall unsafe "sizeof_fd_set" #endif -reportStackOverflow :: IO a -reportStackOverflow = do callStackOverflowHook; return undefined +reportStackOverflow :: IO () +reportStackOverflow = callStackOverflowHook reportError :: SomeException -> IO () reportError ex = do @@ -1309,15 +1321,4 @@ setUncaughtExceptionHandler = writeIORef uncaughtExceptionHandler 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}