on master help sign in
Minor function rename & comment changes
9364c0fShlok Datye
src/Streamly/Internal/Control/ForkLifted.hs+6−6
@@ -9,7 +9,7 @@
9module Streamly.Internal.Control.ForkLifted
9module Streamly.Internal.Control.ForkLifted
10 (
10 (
11 doFork
11 doFork
12− , doFork'
12+ , doForkWith
13 , fork
13 , fork
14 , forkManaged
14 , forkManaged
15 )
15 )
@@ -33,18 +33,18 @@ doFork :: MonadRunInIO m
33 -> RunInIO m
33 -> RunInIO m
34 -> (SomeException -> IO ())
34 -> (SomeException -> IO ())
35 -> m ThreadId
35 -> m ThreadId
36−doFork = doFork' False
36+doFork = doForkWith False
37
37
38−-- | Similar to 'doFork', but has a "bound" boolean parameter for specifying
38+-- | Similar to 'doFork', but has a \"bound\" boolean parameter for specifying
39-- whether 'forkOS' should be used instead of 'rawForkIO'.
39-- whether 'forkOS' should be used instead of 'rawForkIO'.
40−{-# INLINE doFork' #-}
40+{-# INLINE doForkWith #-}
41−doFork' :: MonadRunInIO m
41+doForkWith :: MonadRunInIO m
42 => Bool
42 => Bool
43 -> m ()
43 -> m ()
44 -> RunInIO m
44 -> RunInIO m
45 -> (SomeException -> IO ())
45 -> (SomeException -> IO ())
46 -> m ThreadId
46 -> m ThreadId
47−doFork' bound action (RunInIO mrun) exHandler =
47+doForkWith bound action (RunInIO mrun) exHandler =
48 withRunInIO $ \run ->
48 withRunInIO $ \run ->
49 mask $ \restore -> do
49 mask $ \restore -> do
50 tid <- (if bound then forkOS else rawForkIO) $
50 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)
28import Data.List (intersperse)
28import Data.List (intersperse)
29import Streamly.Internal.Control.Concurrent
29import Streamly.Internal.Control.Concurrent
30 (MonadAsync, MonadRunInIO, askRunInIO)
30 (MonadAsync, MonadRunInIO, askRunInIO)
31−import Streamly.Internal.Control.ForkLifted (doFork')
31+import Streamly.Internal.Control.ForkLifted (doForkWith)
32import Streamly.Internal.Data.Fold (Fold(..))
32import Streamly.Internal.Data.Fold (Fold(..))
33import Streamly.Internal.Data.Stream.Channel.Dispatcher (dumpSVarStats)
33import Streamly.Internal.Data.Stream.Channel.Dispatcher (dumpSVarStats)
34import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
34import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
@@ -239,7 +239,7 @@ newChannel modifier f = do
239 let config = modifier defaultConfig
239 let config = modifier defaultConfig
240 sv <- liftIO $ mkNewChannel config
240 sv <- liftIO $ mkNewChannel config
241 mrun <- askRunInIO
241 mrun <- askRunInIO
242− void $ doFork' (getBound config) (work sv) mrun (sendExceptionToDriver sv)
242+ void $ doForkWith (getBound config) (work sv) mrun (sendExceptionToDriver sv)
243 return sv
243 return sv
244
244
245 where
245 where
src/Streamly/Internal/Data/Stream/Channel/Types.hs+3
@@ -548,6 +548,9 @@ getInterleaved = _interleaved
548
548
549-- | Spawn bound threads (i.e., spawn threads using 'forkOS' instead of
549-- | Spawn bound threads (i.e., spawn threads using 'forkOS' instead of
550-- 'forkIO'). The default value is 'False'.
550-- 'forkIO'). The default value is 'False'.
551+--
552+-- Currently, this only takes effect for concurrent folds. TODO: Make it
553+-- consistently take effect everywhere.
551bound :: Bool -> Config -> Config
554bound :: Bool -> Config -> Config
552bound flag st = st { _bound = flag }
555bound flag st = st { _bound = flag }
553
556