From 5f01ab16671c46db15d890265167aace7a542b30 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 14 Nov 2012 11:53:23 -0400 Subject: use System.Timeout I'd forgotten this existed! --- Utility/ThreadScheduler.hs | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'Utility') diff --git a/Utility/ThreadScheduler.hs b/Utility/ThreadScheduler.hs index 5e165c9ca..c95225598 100644 --- a/Utility/ThreadScheduler.hs +++ b/Utility/ThreadScheduler.hs @@ -12,7 +12,6 @@ import Common import Control.Concurrent import Control.Exception -import Control.Concurrent.Async import System.Posix.Terminal import System.Posix.Signals @@ -46,19 +45,6 @@ unboundDelay time = do threadDelay $ fromInteger maxWait when (maxWait /= time) $ unboundDelay (time - maxWait) -{- Runs an action until a timeout is reached. If it fails to complete in - - time, or throws an exception, returns a Left value. - - - - Note that if the action runs an unsafe foreign call, the signal to - - cancel it may not arrive until the call returns. -} -runTimeout :: Seconds -> IO a -> IO (Either SomeException a) -runTimeout secs a = do - runner <- async a - controller <- async $ do - threadDelaySeconds secs - cancel runner - cancel controller `after` waitCatch runner - {- Pauses the main thread, letting children run until program termination. -} waitForTermination :: IO () waitForTermination = do -- cgit v1.2.3