blob: 18cf1196f73e6200996054c3ad985a67cd245ff2 (
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 after the
-- transaction
main = do
putStr "Before\n"
t <- atomically ( newTVar 42 )
atomically ( writeTVar t 17 )
r <- atomically ( readTVar t )
putStr ("After " ++ (show r) ++ "\n")
|