Add a few simple concurrency tests. More to come.
--- /dev/null
+#-----------------------------------------------------------------------------
+# $Id: Makefile,v 1.1 1998/06/04 16:15:10 simonm Exp $
+
+TOP = ..
+include $(TOP)/mk/boilerplate.mk
+
+SUBDIRS = should_run
+
+include $(TOP)/mk/target.mk
+
+
--- /dev/null
+module Main where
+
+import Concurrent
+
+-- two processes, one MVar communication.
+
+main = do
+ s <- newEmptyMVar
+ let
+ reader = do
+ str <- takeMVar s
+ putStr str
+
+ forkIO reader
+ putMVar s "hello world\n"
--- /dev/null
+hello world
--- /dev/null
+module Main where
+
+import Concurrent
+
+main = do
+ c <- newChan
+ let
+ reader = do
+ char <- readChan c
+ if (char == '\n')
+ then return ()
+ else do putChar char; reader
+ forkIO reader
+ writeList2Chan c "Hello World\n"
+
--- /dev/null
+Hello World
\ No newline at end of file
--- /dev/null
+module Main where
+
+import Concurrent
+
+-- simple handshaking using two MVars,
+-- must context switch twice for each character.
+
+main = do
+ ready <- newEmptyMVar
+ datum <- newEmptyMVar
+ let
+ reader = do
+ putMVar ready ()
+ char <- takeMVar datum
+ if (char == '\n')
+ then return ()
+ else do putChar char; reader
+
+ writer "" = do
+ takeMVar ready
+ putMVar datum '\n'
+ writer (c:cs) = do
+ takeMVar ready
+ putMVar datum c
+ writer cs
+
+ forkIO reader
+ writer "Hello World"
--- /dev/null
+Hello World
\ No newline at end of file