https://kotlinlang.org logo
Title
g

groostav

08/21/2018, 11:51 PM
Is there a way I can specify to
produce
that I dont want it to run its block until somebody calls
recieve
from it? IE a kind of pull based channel?
l

louiscad

08/22/2018, 5:19 AM
Just specify the
start
parameter to be
CoroutineStart.LAZY
👍 2
u

uli

08/22/2018, 5:30 AM
Produce takes an optional parameter capacity which is the size of the channels queue. If the queue is full, send will suspend.
g

groostav

08/22/2018, 8:33 PM
right, but a capacity of 0 gives me a rendesvous channel, which is not the behaviour I want
@louiscad unfortunately
produce
doesnt take a coroutine start, its hard-coded to use
default
u

uli

08/22/2018, 11:36 PM
oh, after the first call to
receive
, you want the producer to run unthrottled?