Is this a concurrency bug in base?

wagnerdm at seas.upenn.edu wagnerdm at seas.upenn.edu
Sun Oct 9 17:56:17 CEST 2011


Quoting Jean-Marie Gaillourdet <jmg at gaillourdet.net>:

> That sounds plausible. Do you see any workaround? Perhaps repeatedly  
> evaluating typeOf?

If there's a concurrency bug, surely the workaround is to protect  
calls to the non-thread-safe function with a lock.

     typeOfWorkaround lock v = do
         () <- takeMVar lock
         x <- evaluate (typeOf v)
         putMVar lock ()
         return x

~d



More information about the Glasgow-haskell-users mailing list