diff options
author | Joey Hess <joey@kitenet.net> | 2012-11-14 11:53:23 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-11-14 11:53:23 -0400 |
commit | 5f01ab16671c46db15d890265167aace7a542b30 (patch) | |
tree | 7832442e76e65c3d2c18874cdb08e4685f3ac9a1 /Utility/ThreadScheduler.hs | |
parent | 3b0234979dc607207195249f2766a37f125746d0 (diff) |
use System.Timeout
I'd forgotten this existed!
Diffstat (limited to 'Utility/ThreadScheduler.hs')
-rw-r--r-- | Utility/ThreadScheduler.hs | 14 |
1 files changed, 0 insertions, 14 deletions
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 |