on master help sign in
Fix draining of threads (serial instead of parallel)
6ec80a0Harendra Kumar
src/Asyncly/AsyncT.hs+2−2
@@ -263,7 +263,7 @@ pullSideDispatch :: MonadAsync m
263pullSideDispatch ctx m1 m2 = AsyncT $ \_ stp yld -> do
263pullSideDispatch ctx m1 m2 = AsyncT $ \_ stp yld -> do
264 let chan = childChannel ctx
264 let chan = childChannel ctx
265 _ <- doFork (push (ctx {pullSide = False}) m1) (handlePushException chan)
265 _ <- doFork (push (ctx {pullSide = False}) m1) (handlePushException chan)
266− liftIO $ threadDelay 0
266+ -- liftIO $ threadDelay 0
267 liftIO $ writeIORef (pendingWork ctx) m2
267 liftIO $ writeIORef (pendingWork ctx) m2
268 (runAsyncT (pullDispatch ctx False)) Nothing stp yld
268 (runAsyncT (pullDispatch ctx False)) Nothing stp yld
269
269
@@ -307,7 +307,7 @@ pullFork m1 m2 = AsyncT $ \_ stp yld -> do
307
307
308 newContext m = do
308 newContext m = do
309 channel <- atomically newTChan
309 channel <- atomically newTChan
310− work <- liftIO $ newIORef (m <|> pullDrain channel)
310+ work <- liftIO $ newIORef (m <> pullDrain channel)
311 return $ Context { childChannel = channel
311 return $ Context { childChannel = channel
312 , pullSide = True
312 , pullSide = True
313 , pendingWork = work
313 , pendingWork = work