Created
January 20, 2014 22:15
-
-
Save tuttlem/8530352 to your computer and use it in GitHub Desktop.
fork1.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Concurrent | |
main :: IO () | |
main = do | |
-- grab the parent thread id and print it | |
parentId <- myThreadId | |
putStrLn (show parentId) | |
-- create a new thread (ignore the return) | |
_ <- forkIO $ do | |
-- grab the child thread id and print it | |
childId <- myThreadId | |
putStrLn (show childId) | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment