From: simonmar Date: Mon, 4 Jun 2001 16:34:19 +0000 (+0000) Subject: [project @ 2001-06-04 16:34:19 by simonmar] X-Git-Tag: Approximately_9120_patches~1814 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=sidebyside;h=1d35a9fdaef6d29e5ac19c2c0318d8e86b5070b2;p=ghc-hetmet.git [project @ 2001-06-04 16:34:19 by simonmar] Add test for Manuel's finalizer bug. --- diff --git a/ghc/tests/concurrent/should_run/conc031.hs b/ghc/tests/concurrent/should_run/conc031.hs new file mode 100644 index 0000000..c992d57 --- /dev/null +++ b/ghc/tests/concurrent/should_run/conc031.hs @@ -0,0 +1,30 @@ +import Concurrent +import Exception +import IOExts +import Weak + +data P = P (MVar Bool) + +-- Bug reported by Manuel Chakravarty, namely that we weren't checking +-- for runnable finalizers before declaring that the program is +-- deadlocked. + +main = do +-- gcThread -- with this thread enabled, no error + mv <- newEmptyMVar + let p = P mv + addFinalizer p (set p) + takeMVar mv >>= print + putStrLn "End." + where + set (P mv) = putMVar mv True + -- + -- this is just to demonstrate that it is only about the GC timing + -- + gcThread = forkIO $ let gc = do + putStrLn "delay" + threadDelay 100000 + putStrLn "gc" + performGC + gc + in gc diff --git a/ghc/tests/concurrent/should_run/conc031.stdout b/ghc/tests/concurrent/should_run/conc031.stdout new file mode 100644 index 0000000..8d45abf --- /dev/null +++ b/ghc/tests/concurrent/should_run/conc031.stdout @@ -0,0 +1,2 @@ +True +End.