KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
import Control.Concurrent main = do forkIO $ putStrLn "123" forkIO $ putStrLn "456" I have written the code above. But when I executed it, I always got 123 only. 456 is not printed. I guess it is because main thread ended before the other thread so the whole program just ended. How can I prevent this? Any api can make sure main thread ended after all threads ended? OS: OS X 10.8.3 compiler: ghc 7.4.2
Tags (comma-separated)
Save Edits
Cancel