annotate MVar.hs @ 0:fa93d5b5b600

Initial commit
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Tue, 16 Jul 2013 15:21:46 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 import Control.Concurrent
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 communicate = do
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 m <- newEmptyMVar
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 forkIO $ do
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 v <- takeMVar m
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 putStrLn ("received " ++ show v)
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 putStrLn "sending"
fa93d5b5b600 Initial commit
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 putMVar m "wake up"