@@ -23,8 +23,8 @@ module Streamly.Streams.SVar
2323 (
2424 fromSVar
2525 , toSVar
26− , threads
27− , buffer
26+ , maxThreads
27+ , maxBuffer
2828 )
2929where
3030
@@ -89,32 +89,22 @@ toSVar sv m = toStreamVar sv (toStream m)
8989-- when using concurrent streams. This is not the grand total number of threads
9090-- but maximum threads at each point of concurrency.
9191-- A value of 0 resets the thread limit to default, a negative value means
92−-- there is no limit. Note that this primitive has no effect on 'Parallel'
93−-- streams, the number of threads for 'Parallel' streams are always unbounded.
94−--
95−-- This primitive can be used at any point in the composition, and it affects
96−-- only the enclosed stream. When nested primitives are used the nearest
97−-- enclosing primitive overrides the outer ones.
98−-- Note that the use of this primitive does not enable concurrency, to enable
99−-- concurrency you have to use one of the concurrent stream type combinators.
92+-- there is no limit.
10093--
10194-- @since 0.4.0
102−threads :: IsStream t => Int -> t m a -> t m a
103−threads n m = fromStream $ Stream $ \st stp sng yld -> do
95+maxThreads :: IsStream t => Int -> t m a -> t m a
96+maxThreads n m = fromStream $ Stream $ \st stp sng yld -> do
10497 let n' = if n == 0 then defaultMaxThreads else n
105− unStream (toStream m) (st {maxThreads = n'}) stp sng yld
98+ unStream (toStream m) (st {threadsHigh = n'}) stp sng yld
10699
107100-- | Specify the maximum size of the buffer for storing the results from
108101-- concurrent computations. If the buffer becomes full we stop spawning more
109102-- concurrent tasks until there is space in the buffer.
110103-- A value of 0 resets the buffer size to default, a negative value means
111−-- there is no limit. Note that this primitive has no effect on 'Parallel'
112−-- streams, the buffer size for 'Parallel' streams is always unbounded.
113−--
114−-- The same scoping rules apply as for the 'threads' primitive.
104+-- there is no limit.
115105--
116106-- @since 0.4.0
117−buffer :: IsStream t => Int -> t m a -> t m a
118−buffer n m = fromStream $ Stream $ \st stp sng yld -> do
107+maxBuffer :: IsStream t => Int -> t m a -> t m a
108+maxBuffer n m = fromStream $ Stream $ \st stp sng yld -> do
119109 let n' = if n == 0 then defaultMaxBuffer else n
120− unStream (toStream m) (st {maxBuffer = n'}) stp sng yld
110+ unStream (toStream m) (st {bufferHigh = n'}) stp sng yld