Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread timothyhobbs
: [Haskell-cafe] multi-thread and lazy evaluation On Mon, 2012-12-24 at 16:16 +0100, timothyho...@seznam.cz wrote: The real question is, does this mean that GHC is stopping the world every time it puts an MVar? No, GHC rts only locks the MVar itself. See here: http://hackage.haskell.org/trac/ghc

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread Corentin Dupont
Hi Brandon, indeed in my example if you add: *b - evaluate a* after the definition of a it works. However, in my original program it doesn't work, I suppose because I interpret the user submitted code (here *let (a::String) = a * for the example) via Hint and Hint-server, and the interpretation

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread Corentin Dupont
. I've narrowed this down and filed a bug report here: http://hackage.haskell.org/trac/ghc/ticket/7528 Timothy -- Původní zpráva -- Od: Yuras Shumovich shumovi...@gmail.com Datum: 24. 12. 2012 Předmět: Re: [Haskell-cafe] multi-thread and lazy evaluation On Mon, 2012-12

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread timothyhobbs
confirmed? Tim -- Původní zpráva -- Od: Corentin Dupont corentin.dup...@gmail.com Datum: 25. 12. 2012 Předmět: Re: [Haskell-cafe] multi-thread and lazy evaluation Great, with me compiled with ghc -threaded the bug shows up. However, runnning main in ghci doesn't show the bug

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-25 Thread Yuras Shumovich
corentin.dup...@gmail.com Datum: 25. 12. 2012 Předmět: Re: [Haskell-cafe] multi-thread and lazy evaluation Great, with me compiled with ghc -threaded the bug shows up. However, runnning main in ghci doesn't show the bug (it finishes correctly). I have GHC 7.4.1. Corentin

[Haskell-cafe] multi-thread and lazy evaluation

2012-12-24 Thread Corentin Dupont
Hi all, I have a program where the user can submit his own little programs, which are interpreted using Hint. The user-submitted programs are used to modify a state held in a TVar. As of course those user-submitted programs can't be trusted, I'm trying to protect them, like in Mueval. I installed

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-24 Thread Corentin Dupont
Sorry, I'm thinking my example program wasn't maybe too explicit. In it, the line *let (a::String) = a* represents the program submitted by the user, that is faulty. The objective is to stop it after some time, and set the (TVar MyData) to its previous value. As you can see, it works only if I put

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-24 Thread Brandon Allbery
On Mon, Dec 24, 2012 at 8:45 AM, Corentin Dupont corentin.dup...@gmail.comwrote: *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

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-24 Thread timothyhobbs
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 allber...@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

Re: [Haskell-cafe] multi-thread and lazy evaluation

2012-12-24 Thread Yuras Shumovich
On Mon, 2012-12-24 at 16:16 +0100, timothyho...@seznam.cz wrote: The real question is, does this mean that GHC is stopping the world every time it puts an MVar? No, GHC rts only locks the MVar itself. See here: http://hackage.haskell.org/trac/ghc/browser/rts/PrimOps.cmm#L1358 Yuras