[project @ 1996-07-25 20:43:49 by partain]
[ghc-hetmet.git] / ghc / lib / concurrent / Parallel.hs
1 {-
2 %
3 % (c) The GRASP/AQUA Project, Glasgow University, 1995-1996
4 %
5 \section[Parallel]{Parallel Constructs}
6 -}
7
8 module Parallel (par, seq -- re-exported
9 #if defined(__GRANSIM__)
10         , parGlobal, parLocal, parAt, parAtForNow     
11 #endif
12     ) where
13
14 import GHCbase ( par, seq )
15 import GHCerr  ( parError )
16
17 #if defined(__GRANSIM__)
18
19 {-# INLINE parGlobal #-}
20 parGlobal   :: Int -> Int -> Int -> Int -> a -> b -> b
21 parLocal    :: Int -> Int -> Int -> Int -> a -> b -> b
22 parAt       :: Int -> Int -> Int -> Int -> a -> b -> c -> c
23 parAtForNow :: Int -> Int -> Int -> Int -> a -> b -> c -> c
24
25 parGlobal (I# w) (I# g) (I# s) (I# p) x y = case (parGlobal# x w g s p y) of { 0# -> parError; _ -> y }
26 parLocal  (I# w) (I# g) (I# s) (I# p) x y = case (parLocal#  x w g s p y) of { 0# -> parError; _ -> y }
27
28 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 }
29 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 }
30
31 #endif
32
33 -- Maybe parIO and the like could be added here later.