Merge pull request #77 from gamazeps/cancel

Make cancel blocking
This commit is contained in:
Michael Walker 2017-04-05 20:33:23 +01:00 committed by GitHub
commit dcddfa42a5

View File

@ -292,7 +292,7 @@ waitCatchSTM (Async _ w) = w
-- 'cancel' can of course be obtained by wrapping 'cancel' itself in -- 'cancel' can of course be obtained by wrapping 'cancel' itself in
-- 'async'. -- 'async'.
cancel :: MonadConc m => Async m a -> m () cancel :: MonadConc m => Async m a -> m ()
cancel (Async tid _) = throwTo tid ThreadKilled cancel a@(Async tid _) = throwTo tid ThreadKilled <* waitCatch a
-- | Cancel an asynchronous action by throwing the supplied exception -- | Cancel an asynchronous action by throwing the supplied exception
-- to it. -- to it.