annotate MVar.hs @ 2:adc9ccc88192 default tip

add fib
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Tue, 30 Jul 2013 17:54:19 +0900
parents fa93d5b5b600
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"