Skip to content
Snippets Groups Projects
Commit 9b98ffdb authored by Jens Nolte's avatar Jens Nolte
Browse files

Add BlockedIndefinitelyOnAwait to signal hangups during await

parent 509c8d41
No related branches found
No related tags found
No related merge requests found
......@@ -73,8 +73,18 @@ class (MonadCatch m, MonadFail m, MonadPlus m, MonadFix m) => MonadAwait m where
-- awaitable.
unsafeAwaitSTM :: STM a -> m a
data BlockedIndefinitelyOnAwait = BlockedIndefinitelyOnAwait
deriving stock Show
instance Exception BlockedIndefinitelyOnAwait where
displayException BlockedIndefinitelyOnAwait = "Thread blocked indefinitely in an 'await' operation"
instance MonadAwait IO where
await awaitable = liftIO $ runQueryT atomically (runAwaitable awaitable)
await awaitable = liftIO do
runQueryT atomically (runAwaitable awaitable)
`catch`
\BlockedIndefinitelyOnSTM -> throwM BlockedIndefinitelyOnAwait
unsafeAwaitSTM = atomically
instance MonadAwait m => MonadAwait (ReaderT a m) where
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment