[project @ 2003-05-12 10:16:22 by ross]
[ghc-base.git] / Control / Concurrent.hs
index a9fd3f6..06e4b1a 100644 (file)
@@ -21,11 +21,15 @@ module Control.Concurrent (
        -- * Basic concurrency operations
 
         ThreadId,
+#ifdef __GLASGOW_HASKELL__
        myThreadId,
+#endif
 
        forkIO,
+#ifdef __GLASGOW_HASKELL__
        killThread,
        throwTo,
+#endif
 
        -- * Scheduling
 
@@ -52,8 +56,10 @@ module Control.Concurrent (
        module Control.Concurrent.SampleVar,
 
        -- * Merging of streams
+#ifndef __HUGS__
        mergeIO,                -- :: [a]   -> [a] -> IO [a]
        nmergeIO,               -- :: [[a]] -> IO [a]
+#endif
        -- $merge
 
        -- * GHC's implementation of concurrency
@@ -84,8 +90,7 @@ import GHC.Base
 #endif
 
 #ifdef __HUGS__
-import IOExts ( unsafeInterleaveIO )
-import ConcBase
+import Hugs.ConcBase
 #endif
 
 import Control.Concurrent.MVar
@@ -94,6 +99,10 @@ import Control.Concurrent.QSem
 import Control.Concurrent.QSemN
 import Control.Concurrent.SampleVar
 
+#ifdef __HUGS__
+type ThreadId = ()
+#endif
+
 {- $conc_intro
 
 The concurrency extension for Haskell is described in the paper
@@ -108,8 +117,8 @@ doesn't make use of any operating system-supplied thread packages.
 Haskell threads can communicate via 'MVar's, a kind of synchronised
 mutable variable (see "Control.Concurrent.MVar").  Several common
 concurrency abstractions can be built from 'MVar's, and these are
-provided by the "Concurrent" library.  Threads may also communicate
-via exceptions. 
+provided by the "Control.Concurrent" library.
+In GHC, threads may also communicate via exceptions.
 -}
 
 {- $conc_scheduling
@@ -204,7 +213,7 @@ real_handler ex =
 
 #endif /* __GLASGOW_HASKELL__ */
 
-
+#ifndef __HUGS__
 max_buff_size :: Int
 max_buff_size = 1
 
@@ -276,6 +285,7 @@ nmergeIO lss
     return val
   where
     mapIO f xs = sequence (map f xs)
+#endif /* __HUGS__ */
 
 -- ---------------------------------------------------------------------------
 -- More docs
@@ -302,7 +312,7 @@ nmergeIO lss
 >     return mvar
 
       Note that we use 'finally' from the
-      "Exception" module to make sure that the
+      "Control.Exception" module to make sure that the
       'MVar' is written to even if the thread dies or
       is killed for some reason.
 
@@ -351,7 +361,7 @@ nmergeIO lss
 
       The rescheduling timer runs on a 20ms granularity by
       default, but this may be altered using the
-      @-i<n>@ RTS option.  After a rescheduling
+      @-i\<n\>@ RTS option.  After a rescheduling
       \"tick\" the running thread is pre-empted as soon as
       possible.