@@ -0,0 +1,30 @@
1+import Control.Concurrent (threadDelay, myThreadId)
2+import Control.Monad.IO.Class (liftIO)
3+import System.Random (randomIO)
5+import Control.Applicative
9+main = wait $ threads 3 $ do
10+ liftIO $ hSetBuffering stdout LineBuffering
11+ mainThread <- liftIO myThreadId
12+ liftIO $ putStrLn $ "Main thread: " ++ show mainThread
17+ x <- sample (randomIO :: IO Int) 1000000
18+ evThread <- liftIO myThreadId
19+ liftIO $ putStrLn $ "X Event thread: " ++ show evThread
20+ liftIO $ putStrLn $ "x = " ++ (show x)
24+ y <- sample (randomIO :: IO Int) 1000000
26+ -- liftIO $ threadDelay 10000000
27+ evThread <- liftIO myThreadId
28+ liftIO $ putStrLn $ "Y Event thread: " ++ show evThread
29+ liftIO $ putStrLn $ "y = " ++ (show y)