Skip to content

Commit

Permalink
waitBoth: Apply the workaround from simonmar#15
Browse files Browse the repository at this point in the history
  • Loading branch information
ttuegel committed Mar 2, 2020
1 parent 1adc73c commit 9a71783
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Control/Concurrent/Async.hs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,10 @@ waitEitherCancel left right =
--
{-# INLINE waitBoth #-}
waitBoth :: Async a -> Async b -> IO (a,b)
waitBoth left right = atomically (waitBothSTM left right)
waitBoth left right = tryAgain $ atomically (waitBothSTM left right)
where
-- See: https://github.com/simonmar/async/issues/14
tryAgain f = f `catch` \BlockedIndefinitelyOnSTM -> f

-- | A version of 'waitBoth' that can be used inside an STM transaction.
--
Expand Down

0 comments on commit 9a71783

Please sign in to comment.