[project @ 1998-06-05 11:51:44 by simonm]
authorsimonm <unknown>
Fri, 5 Jun 1998 11:51:45 +0000 (11:51 +0000)
committersimonm <unknown>
Fri, 5 Jun 1998 11:51:45 +0000 (11:51 +0000)
ChannelVar test.

ghc/tests/concurrent/should_run/conc005.hs [new file with mode: 0644]
ghc/tests/concurrent/should_run/conc005.stdout [new file with mode: 0644]

diff --git a/ghc/tests/concurrent/should_run/conc005.hs b/ghc/tests/concurrent/should_run/conc005.hs
new file mode 100644 (file)
index 0000000..5cbcca7
--- /dev/null
@@ -0,0 +1,21 @@
+module Main where
+
+import Concurrent
+
+-- same as conc004, but using the ChannelVar abstraction
+
+main = do
+  v <- newCVar
+  let
+       reader = do
+           c <- readCVar v
+           if (c == '\n') 
+               then return () 
+               else do putChar c; reader
+
+       writer []     = do writeCVar v '\n'; return ()
+       writer (c:cs) = do writeCVar v c;    writer cs
+
+  forkIO reader
+  writer "Hello World"
+  
diff --git a/ghc/tests/concurrent/should_run/conc005.stdout b/ghc/tests/concurrent/should_run/conc005.stdout
new file mode 100644 (file)
index 0000000..5e1c309
--- /dev/null
@@ -0,0 +1 @@
+Hello World
\ No newline at end of file