Haskell by Example: Channels

original
import Control.Concurrent
import Control.Concurrent.STM

main = do
    messages <- atomically newTQueue

    forkIO $ atomically $ writeTQueue messages "ping"

    msg <- atomically $ readTQueue messages
    putStrLn msg
$ runhaskell channels.hs
ping
back to index