Commit 64ac7ed5 authored by sof's avatar sof
Browse files

[project @ 2002-03-02 18:09:32 by sof]

make them compile again
parent c8adbae0
......@@ -4,7 +4,6 @@ module Main where
import Control.Concurrent
import Control.Exception
import IOExts
choose :: a -> a -> IO a
choose a b = do
......@@ -14,7 +13,7 @@ choose a b = do
b_id <- myForkIO (b `seq` takeMVar ready >> putMVar answer b)
it <- takeMVar answer
killThread a_id
killThread b_id
-- killThread b_id
return it
-- We need to catch the exception raised by killThread and ignore it.
......@@ -22,7 +21,7 @@ choose a b = do
-- exception is raised in any thread.
myForkIO :: IO () -> IO ThreadId
myForkIO io = forkIO (Exception.catch io (\e -> return ()))
myForkIO io = forkIO (Control.Exception.catch io (\e -> return ()))
main = do
let big = sum [1..]
......
......@@ -9,4 +9,4 @@ import Control.Exception
main = do
id <- myThreadId
Exception.catch (killThread id) (\e -> putStr (show e))
Control.Exception.catch (killThread id) (\e -> putStr (show e))
......@@ -22,7 +22,7 @@ main = do
block <- newEmptyMVar
ready <- newEmptyMVar
ready2 <- newEmptyMVar
id <- forkIO (Exception.catch (putMVar ready () >> takeMVar block)
id <- forkIO (Control.Exception.catch (putMVar ready () >> takeMVar block)
(\e -> putStr (show e) >> putMVar ready2 ()))
takeMVar ready
throwTo id (ErrorCall "hello")
......
......@@ -2,7 +2,7 @@ module Main where
import Control.Concurrent
import Control.Exception
import GlaExts
--import GlaExts
data Result = Died Exception | Finished
......@@ -15,7 +15,7 @@ stackoverflow n = n + stackoverflow n
main = do
let x = stackoverflow 1
result <- newEmptyMVar
forkIO (Exception.catch (x `seq` putMVar result Finished)
forkIO (Control.Exception.catch (x `seq` putMVar result Finished)
(\e -> putMVar result (Died e)))
res <- takeMVar result
case res of
......
......@@ -9,8 +9,8 @@ main = do
m <- newEmptyMVar
forkIO (do { takeMVar m; throwTo main_thread (ErrorCall "foo") })
(error "wibble")
`Exception.catch` (\e -> do putMVar m ()
sum [1..10000] `seq` putStrLn "done.")
`Control.Exception.catch` (\e -> do putMVar m ()
sum [1..10000] `seq` putStrLn "done.")
(threadDelay 500000)
`Exception.catch` (\e -> putStrLn ("caught: " ++ show e))
`Control.Exception.catch` (\e -> putStrLn ("caught: " ++ show e))
......@@ -24,9 +24,9 @@ main = do
putMVar m ()
sum [1..10000] `seq` -- give 'foo' a chance to be raised
(unblock (threadDelay 500000))
`Exception.catch` (\e -> putStrLn ("caught1: " ++ show e))
`Control.Exception.catch` (\e -> putStrLn ("caught1: " ++ show e))
)
takeMVar m2
)
`Exception.catch`
`Control.Exception.catch`
(\e -> putStrLn ("caught2: " ++ show e))
......@@ -23,13 +23,13 @@ main = do
-- unblocked, "foo" delivered to "caught1"
threadDelay 100000
)
) `Exception.catch` (\e -> putStrLn ("caught1: " ++ show e))
) `Control.Exception.catch` (\e -> putStrLn ("caught1: " ++ show e))
putMVar m2 ()
-- blocked here, "bar" can't be delivered
(sum [1..10000] `seq` return ())
`Exception.catch` (\e -> putStrLn ("caught2: " ++ show e))
`Control.Exception.catch` (\e -> putStrLn ("caught2: " ++ show e))
)
-- unblocked here, "bar" delivered to "caught3"
takeMVar m3
)
`Exception.catch` (\e -> putStrLn ("caught3: " ++ show e))
`Control.Exception.catch` (\e -> putStrLn ("caught3: " ++ show e))
......@@ -6,7 +6,7 @@ import Control.Exception
main = do
t <- forkIO (
Exception.catch (do
Control.Exception.catch (do
m <- newMVar ()
putMVar m ()
)
......
......@@ -3,7 +3,7 @@ import Control.Concurrent
import Control.Exception
main = do
forkIO (Exception.catch (do { m <- newEmptyMVar; takeMVar m })
forkIO (Control.Exception.catch (do { m <- newEmptyMVar; takeMVar m })
(\e -> putStrLn ("caught: " ++ show e)))
let x = sum [1..10000]
x `seq` print x
......@@ -34,7 +34,7 @@ timeout secs action on_timeout
killThread timeout
return result
)
`Exception.catch`
`Control.Exception.catch`
( \exception -> case exception of
ErrorCall "__timeout" -> on_timeout
_other -> do
......@@ -45,5 +45,5 @@ forkIOIgnoreExceptions :: IO () -> IO ThreadId
forkIOIgnoreExceptions action = IO $ \ s ->
case (fork# action_plus s) of (# s1, id #) -> (# s1, ThreadId id #)
where
action_plus = Exception.catch action (\_ -> return ())
action_plus = Control.Exception.catch action (\_ -> return ())
import Control.Concurrent
import Exception
import IOExts
import Weak
import Control.Exception
import System.Mem ( performGC )
import System.Mem.Weak ( addFinalizer )
data P = P (MVar Bool)
......
......@@ -3,7 +3,7 @@
-- !!! same MVar.
import Control.Concurrent
import IOExts
import System.IO.Unsafe
awk True True z = 1
awk False y True = 2
......
......@@ -3,7 +3,7 @@ import Control.Exception
-- !!! test that deadlock is raised as an exception properly
main = do
r <- Exception.try $ do
r <- Control.Exception.try $ do
m <- newEmptyMVar
takeMVar m
return ()
......
......@@ -11,5 +11,5 @@ main = do
let a = sum [1..10000] + b
b = sum [2..10000] + a
forkIO (print a)
r <- Exception.try $ print b
r <- Control.Exception.try $ print b
print r
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