@@ -286,19 +286,19 @@ dispatchWorkerPaced sv = do
286286{-# NOINLINE sendWorkerWait #-}
287287sendWorkerWait
288288 :: MonadIO m
289− => (Channel m a -> IO ())
289+ => Bool
290+ -> (Channel m a -> IO ())
290291 -> (Channel m a -> m Bool)
291292 -> Channel m a
292293 -> m ()
293−sendWorkerWait delay dispatch sv = do
294+sendWorkerWait eager delay dispatch sv = do
294295 -- Note that we are guaranteed to have at least one outstanding worker when
295296 -- we enter this function. So if we sleep we are guaranteed to be woken up
296297 -- by an outputDoorBell, when the worker exits.
297298
298299 liftIO $ delay sv
299300 (_, n) <- liftIO $ readIORef (outputQueue sv)
300− -- XXX or eagerDispatch is true
301− when (n <= 0) $ do
301+ when (n <= 0 || eager) $ do
302302 -- The queue may be empty temporarily if the worker has dequeued the
303303 -- work item but has not enqueued the remaining part yet. For the same
304304 -- reason, a worker may come back if it tries to dequeue and finds the
@@ -356,7 +356,7 @@ sendWorkerWait delay dispatch sv = do
356356 -- forever.
357357
358358 if canDoMore
359− then sendWorkerWait delay dispatch sv
359+ then sendWorkerWait eager delay dispatch sv
360360 else do
361361 liftIO
362362 $ withDiagMVar
@@ -365,7 +365,7 @@ sendWorkerWait delay dispatch sv = do
365365 "sendWorkerWait: nothing to do"
366366 $ takeMVar (outputDoorBell sv)
367367 (_, len) <- liftIO $ readIORef (outputQueue sv)
368− when (len <= 0) $ sendWorkerWait delay dispatch sv
368+ when (len <= 0) $ sendWorkerWait eager delay dispatch sv
369369
370370-- | Start the evaluation of the channel's work queue by kicking off a worker.
371371-- Note: Work queue must not be empty otherwise the worker will exit without