2 {-# LANGUAGE CPP, NoImplicitPrelude #-}
3 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
4 {-# OPTIONS_HADDOCK not-home #-}
6 -----------------------------------------------------------------------------
9 -- Copyright : (c) The University of Glasgow, 1994-2002
10 -- License : see libraries/base/LICENSE
12 -- Maintainer : cvs-ghc@haskell.org
13 -- Stability : internal
14 -- Portability : non-portable (GHC extensions)
16 -- Basic concurrency stuff.
18 -----------------------------------------------------------------------------
20 -- No: #hide, because bits of this module are exposed by the stm package.
21 -- However, we don't want this module to be the home location for the
22 -- bits it exports, we'd rather have Control.Concurrent and the other
23 -- higher level modules be the home. Hence:
31 -- * Forking and suchlike
32 , forkIO -- :: IO a -> IO ThreadId
36 , forkOnIO -- :: Int -> IO a -> IO ThreadId
39 , numCapabilities -- :: Int
40 , getNumCapabilities -- :: IO Int
41 , numSparks -- :: IO Int
42 , childHandler -- :: Exception -> IO ()
43 , myThreadId -- :: IO ThreadId
44 , killThread -- :: ThreadId -> IO ()
45 , throwTo -- :: ThreadId -> Exception -> IO ()
46 , par -- :: a -> b -> b
47 , pseq -- :: a -> b -> b
50 , labelThread -- :: ThreadId -> String -> IO ()
52 , ThreadStatus(..), BlockReason(..)
53 , threadStatus -- :: ThreadId -> IO ThreadStatus
57 , threadDelay -- :: Int -> IO ()
58 , registerDelay -- :: Int -> IO (TVar Bool)
59 , threadWaitRead -- :: Int -> IO ()
60 , threadWaitWrite -- :: Int -> IO ()
61 , closeFdWith -- :: (Fd -> IO ()) -> Fd -> IO ()
65 , atomically -- :: STM a -> IO a
67 , orElse -- :: STM a -> STM a -> STM a
68 , throwSTM -- :: Exception e => e -> STM a
69 , catchSTM -- :: Exception e => STM a -> (e -> STM a) -> STM a
70 , alwaysSucceeds -- :: STM a -> STM ()
71 , always -- :: STM Bool -> STM ()
73 , newTVar -- :: a -> STM (TVar a)
74 , newTVarIO -- :: a -> STM (TVar a)
75 , readTVar -- :: TVar a -> STM a
76 , readTVarIO -- :: TVar a -> IO a
77 , writeTVar -- :: a -> TVar a -> STM ()
78 , unsafeIOToSTM -- :: IO a -> STM a
82 #ifdef mingw32_HOST_OS
83 , asyncRead -- :: Int -> Int -> Int -> Ptr a -> IO (Int, Int)
84 , asyncWrite -- :: Int -> Int -> Int -> Ptr a -> IO (Int, Int)
85 , asyncDoProc -- :: FunPtr (Ptr a -> IO Int) -> Ptr a -> IO Int
87 , asyncReadBA -- :: Int -> Int -> Int -> Int -> MutableByteArray# RealWorld -> IO (Int, Int)
88 , asyncWriteBA -- :: Int -> Int -> Int -> Int -> MutableByteArray# RealWorld -> IO (Int, Int)
91 #ifndef mingw32_HOST_OS
92 , Signal, HandlerFun, setHandler, runHandlers
95 , ensureIOManagerIsRunning
97 #ifdef mingw32_HOST_OS
100 , toWin32ConsoleEvent
102 , setUncaughtExceptionHandler -- :: (Exception -> IO ()) -> IO ()
103 , getUncaughtExceptionHandler -- :: IO (Exception -> IO ())
105 , reportError, reportStackOverflow
111 #ifndef mingw32_HOST_OS
112 import GHC.Conc.Signal