@@ -371,7 +371,10 @@ pushWorker ctx =
371{-# INLINE sendWorkerWait #-}
371{-# INLINE sendWorkerWait #-}
372sendWorkerWait :: MonadAsync m => Context m a -> m ()
372sendWorkerWait :: MonadAsync m => Context m a -> m ()
373sendWorkerWait ctx = do
373sendWorkerWait ctx = do
374− liftIO $ threadDelay 200
375+ CtxType _ LIFO -> liftIO $ threadDelay 200
376+ CtxType _ FIFO -> liftIO $ threadDelay 0
375 output <- liftIO $ readIORef (outputQueue ctx)
378 output <- liftIO $ readIORef (outputQueue ctx)
376 when (null output) $ do
379 when (null output) $ do
377 done <- queueEmpty ctx
380 done <- queueEmpty ctx
@@ -387,7 +390,7 @@ instance Exception ContextUsedAfterEOF
387pullFromCtx :: MonadAsync m => Context m a -> AsyncT m a
390pullFromCtx :: MonadAsync m => Context m a -> AsyncT m a
388pullFromCtx ctx = AsyncT $ \_ stp yld -> do
391pullFromCtx ctx = AsyncT $ \_ stp yld -> do
389 -- When using an async handle to the context, one may keep using a stale
392 -- When using an async handle to the context, one may keep using a stale
390− -- context even after it has been fullt drained. To detect it gracefully we
393+ -- context even after it has been fully drained. To detect it gracefully we
391 -- raise an explicit exception.
394 -- raise an explicit exception.
392 -- XXX if reading the IORef is costly we can use a flag in the context to
395 -- XXX if reading the IORef is costly we can use a flag in the context to
393 -- indicate we are done.
396 -- indicate we are done.