Skip to content

Instantly share code, notes, and snippets.

@brinchj
Created February 1, 2012 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brinchj/1cbe113d2c79e2fc9d2b to your computer and use it in GitHub Desktop.
Save brinchj/1cbe113d2c79e2fc9d2b to your computer and use it in GitHub Desktop.
import Control.Concurrent.STM
test :: Int -> TVar [(Int, Int)] -> IO ()
test 0 t = return ()
test n t = do atomically $ do l <- readTVar t
let l' = (n, n) : l
writeTVar t l'
test (n-1) t
main = do
tv <- newTVarIO []
test 2000000 tv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment