Commit 18a64d15 authored by Simon Marlow's avatar Simon Marlow

make the test fail if the sleep doesn't get interrupted (#5471)

parent feacf3da
......@@ -20,10 +20,17 @@ main :: IO ()
main = do
newStablePtr stdout -- prevent stdout being finalized
th <- newEmptyMVar
tid <- forkIO $ do
putStrLn "newThread started"
(sleep 2 >> putStrLn "fail") `catch` (\ThreadKilled -> putStrLn "pass")
putMVar th "child"
-- if the killThread below gets blocked for more than a second, then
-- this thread will kill the main thread and the test will fail.
main <- myThreadId
forkIO $ do threadDelay 1000000; throwTo main (ErrorCall "still waiting")
yield
threadDelay 500000
killThread tid
......
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