changeset 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 e527b0150748
files MVar.hs NumCapabilities.hs
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MVar.hs	Tue Jul 16 15:21:46 2013 +0900
@@ -0,0 +1,9 @@
+import Control.Concurrent
+
+communicate = do
+  m <- newEmptyMVar
+  forkIO $ do
+    v <- takeMVar m
+    putStrLn ("received " ++ show v)
+  putStrLn "sending"
+  putMVar m "wake up"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NumCapabilities.hs	Tue Jul 16 15:21:46 2013 +0900
@@ -0,0 +1,7 @@
+import GHC.Conc (numCapabilities)
+import System.Environment (getArgs)
+
+main = do
+  args <- getArgs
+  putStrLn $ "command line arguments: " ++ show args
+  putStrLn $ "number of cores: " ++ show numCapabilities