on master help sign in
Fix maxThreads being ignored
commit75fdf1f96454cb3c621e744048f611f5d59b8430 authorLuke Clifton <lukec@themk.net> dateTue 26 Mar 2019, 21:28 (8 years ago) parent02ed9f7
1 file changed+8−5
src/Streamly/SVar.hs+8−5
src/Streamly/SVar.hs+8−5
@@ -1426,10 +1426,13 @@ dispatchWorker yieldCount sv = do
14261426 Nothing -> return workerLimit
14271427 Just ref -> do
14281428 n <- liftIO $ readIORef ref
1429− return $
1430− case workerLimit of
1431− Unlimited -> Limited (fromIntegral n)
1432− Limited lim -> Limited $ min lim (fromIntegral n)
1429+ case yieldRateInfo sv of
1430+ Just _ -> return workerLimit
1431+ Nothing ->
1432+ return $
1433+ case workerLimit of
1434+ Unlimited -> Limited (fromIntegral n)
1435+ Limited lim -> Limited $ min lim (fromIntegral n)
14331436
14341437 -- XXX for ahead streams shall we take the heap yields into account
14351438 -- for controlling the dispatch? We should not dispatch if the heap
@@ -1442,7 +1445,7 @@ dispatchWorker yieldCount sv = do
14421445 -- and using them here, so this is just approximate logic and
14431446 -- we cannot rely on it for correctness. We may actually
14441447 -- dispatch more workers than required.
1445− Limited lim | lim > 0 -> dispatch
1448+ Limited lim | lim > fromIntegral active -> dispatch
14461449 _ -> return False
14471450 else do
14481451 when (active <= 0) $ pushWorker 0 sv