on master help sign in
Minor function rename & comment changes
commit9364c0fcb6de67a70c76b03a7b2655b35ca7b41a authorShlok Datye <shlok@quant.is> dateWed 17 May 2023, 08:48 (3 years ago) parent44b0ae0
3 files changed+11−8
src/Streamly/Internal/Control/ForkLifted.hs+6−6 src/Streamly/Internal/Data/Fold/Concurrent/Channel/Type.hs+2−2 src/Streamly/Internal/Data/Stream/Channel/Types.hs+3
src/Streamly/Internal/Control/ForkLifted.hs+6−6
@@ -9,7 +9,7 @@
99module Streamly.Internal.Control.ForkLifted
1010 (
1111 doFork
12− , doFork'
12+ , doForkWith
1313 , fork
1414 , forkManaged
1515 )
@@ -33,18 +33,18 @@ doFork :: MonadRunInIO m
3333 -> RunInIO m
3434 -> (SomeException -> IO ())
3535 -> m ThreadId
36−doFork = doFork' False
36+doFork = doForkWith False
3737
38−-- | Similar to 'doFork', but has a "bound" boolean parameter for specifying
38+-- | Similar to 'doFork', but has a \"bound\" boolean parameter for specifying
3939-- whether 'forkOS' should be used instead of 'rawForkIO'.
40−{-# INLINE doFork' #-}
41−doFork' :: MonadRunInIO m
40+{-# INLINE doForkWith #-}
41+doForkWith :: MonadRunInIO m
4242 => Bool
4343 -> m ()
4444 -> RunInIO m
4545 -> (SomeException -> IO ())
4646 -> m ThreadId
47−doFork' bound action (RunInIO mrun) exHandler =
47+doForkWith bound action (RunInIO mrun) exHandler =
4848 withRunInIO $ \run ->
4949 mask $ \restore -> do
5050 tid <- (if bound then forkOS else rawForkIO) $
src/Streamly/Internal/Data/Fold/Concurrent/Channel/Type.hs+2−2
@@ -28,7 +28,7 @@ import Data.IORef (IORef, newIORef, readIORef)
2828import Data.List (intersperse)
2929import Streamly.Internal.Control.Concurrent
3030 (MonadAsync, MonadRunInIO, askRunInIO)
31−import Streamly.Internal.Control.ForkLifted (doFork')
31+import Streamly.Internal.Control.ForkLifted (doForkWith)
3232import Streamly.Internal.Data.Fold (Fold(..))
3333import Streamly.Internal.Data.Stream.Channel.Dispatcher (dumpSVarStats)
3434import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
@@ -239,7 +239,7 @@ newChannel modifier f = do
239239 let config = modifier defaultConfig
240240 sv <- liftIO $ mkNewChannel config
241241 mrun <- askRunInIO
242− void $ doFork' (getBound config) (work sv) mrun (sendExceptionToDriver sv)
242+ void $ doForkWith (getBound config) (work sv) mrun (sendExceptionToDriver sv)
243243 return sv
244244
245245 where
src/Streamly/Internal/Data/Stream/Channel/Types.hs+3
@@ -548,6 +548,9 @@ getInterleaved = _interleaved
548548
549549-- | Spawn bound threads (i.e., spawn threads using 'forkOS' instead of
550550-- 'forkIO'). The default value is 'False'.
551+--
552+-- Currently, this only takes effect for concurrent folds. TODO: Make it
553+-- consistently take effect everywhere.
551554bound :: Bool -> Config -> Config
552555bound flag st = st { _bound = flag }
553556