async 2.0.1.5 → 2.0.1.6
raw patch · 3 files changed
+20/−2 lines, 3 files
Files
- Control/Concurrent/Async.hs +4/−1
- async.cabal +5/−1
- test/test-async.hs +11/−0
Control/Concurrent/Async.hs view
@@ -246,7 +246,10 @@ -- {-# INLINE waitCatch #-} waitCatch :: Async a -> IO (Either SomeException a)-waitCatch = atomically . waitCatchSTM+waitCatch = tryAgain . atomically . waitCatchSTM+ where+ -- See: https://github.com/simonmar/async/issues/14+ tryAgain f = f `catch` \BlockedIndefinitelyOnSTM -> f -- | Check whether an 'Async' has completed yet. If it has not -- completed yet, then the result is @Nothing@, otherwise the result
async.cabal view
@@ -22,6 +22,10 @@ threads that are automatically killed when their parent dies (see 'withAsync'). .+ Changes in 2.0.1.6:+ .+ * Add workaround to waitCatch for #14+ . Changes in 2.0.1.5: . * Bump @base@ dependencies for GHC 7.8@@ -52,7 +56,7 @@ . * Added @Concurrently@ (with @Applicative@ and @Alternative@ instances) -version: 2.0.1.5+version: 2.0.1.6 license: BSD3 license-file: LICENSE author: Simon Marlow
test/test-async.hs view
@@ -29,6 +29,7 @@ testCase "async_cancel" async_cancel , testCase "async_poll" async_poll , testCase "async_poll2" async_poll2+ , testCase "withasync_waitCatch_blocked" withasync_waitCatch_blocked ] value = 42 :: Int@@ -104,3 +105,13 @@ when (isNothing r) $ assertFailure "" r <- poll a -- poll twice, just to check we don't deadlock when (isNothing r) $ assertFailure ""++withasync_waitCatch_blocked :: Assertion+withasync_waitCatch_blocked = do+ r <- withAsync (newEmptyMVar >>= takeMVar) waitCatch+ case r of+ Left e ->+ case fromException e of+ Just BlockedIndefinitelyOnMVar -> return ()+ Nothing -> assertFailure $ show e+ Right () -> assertFailure ""