[project @ 1996-06-27 16:55:06 by partain]
[ghc-hetmet.git] / ghc / lib / concurrent / Concurrent.hs
1 {-
2 %
3 % (c) The AQUA Project, Glasgow University, 1995
4 %
5 \section[Concurrent]{Concurrent Haskell constructs}
6
7 A common interface to a collection of useful concurrency abstractions.
8 Currently, the collection only contains the abstractions found in the
9 {\em Concurrent Haskell} paper (presented at the Haskell Workshop
10 1995, draft available via \tr{ftp} from
11 \tr{ftp.dcs.gla.ac.uk/pub/glasgow-fp/drafts}.)  plus a couple of
12 others. See the paper and the individual files containing the module
13 definitions for explanation on what they do.
14 -}
15
16 module Concurrent (
17         forkIO,
18         par, seq, fork, -- re-exported from GHCbase
19
20         -- waiting on file descriptor I/O
21         threadWaitRead, threadWaitWrite, 
22
23         -- wait for timeout
24         threadDelay,
25
26         module ChannelVar,
27         module Channel,
28         module Semaphore,
29         module Merge,
30         module SampleVar,
31
32         -- IVars and MVars come from here, too
33         IVar, MVar,
34         newEmptyMVar, takeMVar, putMVar, newMVar, readMVar, swapMVar,
35         newIVar, readIVar, writeIVar
36
37     ) where
38
39 import Parallel
40 import ChannelVar
41 import Channel
42 import Semaphore
43 import Merge
44 import SampleVar
45
46 import GHCbase
47
48 forkIO :: IO () -> IO ()
49
50 forkIO (IO (ST action)) = IO $ ST $ \ s ->
51     let
52         (_, new_s) = action s
53     in
54     new_s `fork` (Right (), s)