[project @ 1997-03-14 05:19:02 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, 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#, parAtForNow# )
19
20 {-# INLINE parGlobal #-}
21 parGlobal   :: Int -> Int -> Int -> Int -> a -> b -> b
22 parLocal    :: Int -> Int -> Int -> Int -> a -> b -> b
23 parAt       :: Int -> Int -> Int -> Int -> a -> b -> c -> c
24 parAtForNow :: Int -> Int -> Int -> Int -> a -> b -> c -> c
25
26 parGlobal (I# w) (I# g) (I# s) (I# p) x y = case (parGlobal# x w g s p y) of { 0# -> parError; _ -> y }
27 parLocal  (I# w) (I# g) (I# s) (I# p) x y = case (parLocal#  x w g s p y) of { 0# -> parError; _ -> y }
28
29 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 }
30 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 }
31
32 #endif
33
34 -- Maybe parIO and the like could be added here later.
35 \end{code}