[Haskell-cafe] multi-thread and lazy evaluation

timothyhobbs at seznam.cz timothyhobbs at seznam.cz
Mon Dec 24 16:16:51 CET 2012


The real question is, does this mean that GHC is stopping the world every 
time it puts an MVar?

Tim

---------- Původní zpráva ----------
Od: Brandon Allbery <allbery.b at gmail.com>
Datum: 24. 12. 2012
Předmět: Re: [Haskell-cafe] multi-thread and lazy evaluation

"

On Mon, Dec 24, 2012 at 8:45 AM, Corentin Dupont <corentin.dupont at gmail.com
(mailto:corentin.dupont at gmail.com)> wrote:

" 

execBlocking :: MVar (Maybe MyData) -> IO ()
execBlocking mv = do
   let (a::String) = a 
   --If you uncomment the next line, it will work
   --putStrLn $ show a
   putMVar mv (Just $ MyData a "toto")

"



It's laziness, yes; you need to do something along the lines of




> let a = length a `seq` a




or possibly Control.Exception.evaluate(http://Control.Exception.evaluate) 
needs to be involved somewhere.

 

-- 


brandon s allbery kf8nh                               sine nomine associates

allbery.b at gmail.com(mailto:allbery.b at gmail.com)                             
     ballbery at sinenomine.net(mailto:ballbery at sinenomine.net)

unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
(http://sinenomine.net)
 


"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121224/f9220a55/attachment.htm>


More information about the Haskell-Cafe mailing list