secret
Created

  • Download Gist
gistfile1.hs
Haskell
1 2 3 4 5 6 7 8 9 10 11 12 13
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.