[project @ 1997-10-21 20:39:15 by sof]
[ghc-hetmet.git] / ghc / lib / concurrent / Parallel.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1995-1996
3 %
4 \section[Parallel]{Parallel Constructs}
5
6 \begin{code}
7 module Parallel (par, seq -- re-exported
8 #if defined(__GRANSIM__)
9         , parGlobal, parLocal, parAt, parAtAbs, parAtRel, parAtForNow     
10 #endif
11     ) where
12
13 import ConcBase ( par )
14
15 #if defined(__GRANSIM__)
16 import PrelBase
17 import GHCerr   ( parError )
18 import GHC      ( parGlobal#, parLocal#, parAt#, parAtAbs#, parAtRel#, parAtForNow# )
19
20 {-# INLINE parGlobal #-}
21 {-# INLINE parLocal #-}
22 {-# INLINE parAt #-}
23 {-# INLINE parAtAbs #-}
24 {-# INLINE parAtRel #-}
25 {-# INLINE parAtForNow #-}
26 parGlobal   :: Int -> Int -> Int -> Int -> a -> b -> b
27 parLocal    :: Int -> Int -> Int -> Int -> a -> b -> b
28 parAt       :: Int -> Int -> Int -> Int -> a -> b -> c -> c
29 parAtAbs    :: Int -> Int -> Int -> Int -> Int -> a -> b -> b
30 parAtRel    :: Int -> Int -> Int -> Int -> Int -> a -> b -> b
31 parAtForNow :: Int -> Int -> Int -> Int -> a -> b -> c -> c
32
33 parGlobal (I# w) (I# g) (I# s) (I# p) x y = case (parGlobal# x w g s p y) of { 0# -> parError; _ -> y }
34 parLocal  (I# w) (I# g) (I# s) (I# p) x y = case (parLocal#  x w g s p y) of { 0# -> parError; _ -> y }
35
36 parAt       (I# w) (I# g) (I# s) (I# p) v x y = case (parAt#       x v w g s p y) of { 0# -> parError; _ -> y }
37 parAtAbs    (I# w) (I# g) (I# s) (I# p) (I# q) x y = case (parAtAbs#  x q w g s p y) of { 0# -> parError; _ -> y }
38 parAtRel    (I# w) (I# g) (I# s) (I# p) (I# q) x y = case (parAtRel#  x q w g s p y) of { 0# -> parError; _ -> y }
39 parAtForNow (I# w) (I# g) (I# s) (I# p) v x y = case (parAtForNow# x v w g s p y) of { 0# -> parError; _ -> y }
40
41 #endif
42
43 -- Maybe parIO and the like could be added here later.
44 \end{code}