+{-
%
% (c) The AQUA Project, Glasgow University, 1995
%
\tr{ftp.dcs.gla.ac.uk/pub/glasgow-fp/drafts}.) plus a couple of
others. See the paper and the individual files containing the module
definitions for explanation on what they do.
+-}
-\begin{code}
module Concurrent (
forkIO,
- par, seq, -- reexported from Parallel
+ par, seq, fork, -- re-exported from GHCbase
- threadWait, threadDelay,
+ -- waiting on file descriptor I/O
+ threadWaitRead, threadWaitWrite,
- ChannelVar..,
- Channel..,
- Semaphore..,
- Merge..,
- SampleVar..,
+ -- wait for timeout
+ threadDelay,
+
+ module ChannelVar,
+ module Channel,
+ module Semaphore,
+ module Merge,
+ module SampleVar,
-- IVars and MVars come from here, too
- IVar(..), MVar(..), -- for convenience...
- _IVar, _MVar, -- abstract
+ IVar, MVar,
newEmptyMVar, takeMVar, putMVar, newMVar, readMVar, swapMVar,
newIVar, readIVar, writeIVar
import Merge
import SampleVar
-import PreludeGlaST ( forkST )
-import PreludePrimIO ( newEmptyMVar, newMVar, putMVar,
- readMVar, swapMVar, takeMVar, _MVar,
- newIVar, readIVar, writeIVar, _IVar,
- IVar(..), MVar(..),
- threadWait, threadDelay
- )
+import GHCbase
forkIO :: IO () -> IO ()
-forkIO action s
- = let
+forkIO (IO (ST action)) = IO $ ST $ \ s ->
+ let
(_, new_s) = action s
in
- new_s `_fork_` (Right (), s)
- where
- _fork_ x y = case (fork# x) of { 0# -> parError#; _ -> y }
-\end{code}
+ new_s `fork` (Right (), s)