Commit 1d35a9fd authored by simonmar's avatar simonmar
Browse files

[project @ 2001-06-04 16:34:19 by simonmar]

Add test for Manuel's finalizer bug.
parent 32a464f1
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."
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"
in gc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment