Skip to content

Commit

Permalink
waitAnyCancel should be using restoreM
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitsutoshi Aoe committed Dec 22, 2014
1 parent 91e0575 commit a9ba1f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/Control/Concurrent/Async/Lifted.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ waitAnyCatch as = do
return (a, r)

-- | Generalized version of 'A.waitAnyCancel'.
waitAnyCancel :: MonadBase IO m => [Async a] -> m (Async a, a)
waitAnyCancel = liftBase . A.waitAnyCancel
waitAnyCancel
:: MonadBaseControl IO m
=> [Async (StM m a)]
-> m (Async (StM m a), a)
waitAnyCancel as = do
(a, s) <- liftBase $ A.waitAnyCancel as
r <- restoreM s
return (a, r)

-- | Generalized version of 'A.waitAnyCatchCancel'.
waitAnyCatchCancel
Expand Down
10 changes: 8 additions & 2 deletions src/Control/Concurrent/Async/Lifted/Safe.hs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,14 @@ waitAnyCatch as = do
return (a, r)

-- | Generalized version of 'A.waitAnyCancel'.
waitAnyCancel :: MonadBase IO m => [Async a] -> m (Async a, a)
waitAnyCancel = liftBase . A.waitAnyCancel
waitAnyCancel
:: (MonadBaseControl IO m, StM m a ~ a)
=> [Async (StM m a)]
-> m (Async (StM m a), a)
waitAnyCancel as = do
(a, s) <- liftBase $ A.waitAnyCancel as
r <- restoreM s
return (a, r)

-- | Generalized version of 'A.waitAnyCatchCancel'.
waitAnyCatchCancel
Expand Down

0 comments on commit a9ba1f4

Please sign in to comment.