Hi Serguey
Thank you for reply. I tried with IORef but I am missing a function which
modify it.
In this case every thread just write value 10 to variable n.
incr_count :: MVar () -> IORef Int -> IO ()
incr_count m n = ( forM_ [ 1 .. 1 ] $ \_ -> writeIORef n 10 ) >>
putMVar m ()
main :: IO
2012/12/18 mukesh tiwari :
> Hello All
> I have two questions.
> 1. I wrote this code to create 10 simultaneous threads. Could some one
> please tell me if this is correct or not ?
>
> incr_count :: MVar () -> MVar Int -> IO ()
> incr_count m n = ( forM_ [ 1..1 ] $ \_ -> modifyMVar_ n ( return
Hello All
I have two questions.
1. I wrote this code to create 10 simultaneous threads. Could some one
please tell me if this is correct or not ?
incr_count :: MVar () -> MVar Int -> IO ()
incr_count m n = ( forM_ [ 1..1 ] $ \_ -> modifyMVar_ n ( return . ( +
10 ) ) ) >> putMVar m ()
main ::