Commit ce5cf242 authored by simonmar's avatar simonmar
Browse files

[project @ 2000-03-21 15:54:25 by simonmar]

Fix up the tests in here.  Now that threadDelay is interruptible, many
of the tests for block/unblockAsyncExceptions failed because they were
relying on exceptions being blocked during a threadDelay.
parent 0a6a055d
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.3 2000/03/13 11:39:22 simonmar Exp $
# $Id: Makefile,v 1.4 2000/03/21 15:54:25 simonmar Exp $
TOP = ../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/should_run.mk
conc009_RUNTEST_OPTS = -x 1
conc018_RUNTEST_OPTS = -x 1
SRC_HC_OPTS += -dcore-lint -syslib concurrent -fglasgow-exts
......
......@@ -10,8 +10,7 @@ main = do
forkIO (do { takeMVar m; raiseInThread main_thread (ErrorCall "foo") })
(error "wibble")
`catchAllIO` (\e -> do putMVar m ()
threadDelay 500000
putStrLn "done.")
sum [1..10000] `seq` putStrLn "done.")
(threadDelay 500000)
`catchAllIO` (\e -> putStrLn ("caught: " ++ show e))
......@@ -22,8 +22,8 @@ main = do
( do
blockAsyncExceptions (do
putMVar m ()
threadDelay 500000
(unblockAsyncExceptions (threadDelay 500000))
sum [1..10000] `seq` -- give 'foo' a chance to be raised
(unblockAsyncExceptions (threadDelay 500000))
`catchAllIO` (\e -> putStrLn ("caught1: " ++ show e))
)
takeMVar m2
......
......@@ -12,7 +12,7 @@ main = do
)
blockAsyncExceptions (do
putMVar m ()
threadDelay 500000 -- to be sure the other thread is now blocked
killThread sub_thread
sum [1..10000] `seq` -- to be sure the other thread is now blocked
killThread sub_thread
)
putStrLn "ok"
......@@ -26,7 +26,7 @@ main = do
) `catchAllIO` (\e -> putStrLn ("caught1: " ++ show e))
putMVar m2 ()
-- blocked here, "bar" can't be delivered
(threadDelay 100000)
(sum [1..10000] `seq` return ())
`catchAllIO` (\e -> putStrLn ("caught2: " ++ show e))
)
-- unblocked here, "bar" delivered to "caught3"
......
import Concurrent
import Exception
main = do
catch (do
catchAllIO (do
m <- newMVar ()
putMVar m ()
)
......
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