On 26 October 2011 21:17, Brent Yorgey <[email protected]> wrote:
> I am pleased to announce that Issue 19 of The Monad.Reader, a special
> issue on parallelism and concurrency, is now available:
Thanks, I always really enjoy The Monad.Reader.
> Issue 19 consists of the following three articles:
>
> * Mighttpd – a High Performance Web Server in Haskell
> by Kazu Yamamoto
Kazu, really interesting article!
I have one question regarding your use of atomicModifyIORef:
x <- atomicModifyIORef ref (\_ -> (tmstr, ()))
x `seq` return ()
Can't you write that as just: writeIORef ref tmstr? If you're not
using the previous value of the IORef there's no chance of
inconsistency.
I looked in the git repository of mighttpd2 and it seems that in the
FileCache module we can make a similar change by rewriting:
remover :: IORef Cache -> IO ()
remover ref = do
threadDelay 10000000
_ <- atomicModifyIORef ref (\_ -> (M.empty, ()))
remover ref
to:
remover :: IORef Cache -> IO ()
remover ref = forever $ do
threadDelay 10000000
writeIORef ref M.empty
Regards,
Bas
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe