mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-14 09:32:22 +00:00
Kill timeout thread if working finished in time.
This commit is contained in:
parent
e2acde3f98
commit
85e4a59a7c
1 changed files with 2 additions and 1 deletions
|
|
@ -98,11 +98,12 @@ withTimeout queue conn t action = do
|
||||||
worker <- forkIO (action >> putMVar finished ())
|
worker <- forkIO (action >> putMVar finished ())
|
||||||
timer <- forkIO $ do
|
timer <- forkIO $ do
|
||||||
threadDelay (10^6 * t)
|
threadDelay (10^6 * t)
|
||||||
|
putMVar finished ()
|
||||||
putStrLn "Timeout"
|
putStrLn "Timeout"
|
||||||
killThread worker
|
killThread worker
|
||||||
_ <- getChanContents queue
|
_ <- getChanContents queue
|
||||||
writeChan queue $ T.pack $ "Error" ++ "Timeout"
|
writeChan queue $ T.pack $ "Error" ++ "Timeout"
|
||||||
putMVar finished ()
|
|
||||||
takeMVar finished `onException` do
|
takeMVar finished `onException` do
|
||||||
killThread worker
|
killThread worker
|
||||||
killThread timer
|
killThread timer
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue