blob: 0ad4701f8b8b7c9666e83b9181e7b19c8c68e639 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
module Main where
import GHC.Conc
-- Create a new TVar, update it and check that it contains the expected value within
-- the transaction
main = do
putStr "Before\n"
t <- atomically ( newTVar 42 )
r <- atomically ( do writeTVar t 17
readTVar t)
putStr ("After " ++ (show r) ++ "\n")
|