-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
start argument for produce. #845
Comments
Any update? What should we do in the mean time? Is the best to use If yes could you mark it with |
I'm working on a replacement DSL API for that. I have not yet created a separate issue for it (I'll have it soon). The approach I'm currently prototyping is this. You replace
Here |
I have a different use case for this. I have a coroutine that runs a loop to process a UI framework (calculate an initial state, wait for events, calculate new state, repeat). It starts this coroutine using the As far as I know, there are two ways to do this:
I would prefer 1, because it doesn't actually block at all, and doesn't require the overhead of allocating a whole new dispatch queue and coroutine just to receive a value that should be immediately available anyway. However, the legacy code that needs to get this value is running on the same thread and hasn't given the I believe if I could start the |
Since the
onCompletion
argument ofproduce
is marked withInternalCoroutinesApi
, the reason why it was introduced (#279) is back on the table.In short: if a resource is open before
produce
, there is no (easy) way to make sure that the resource will always be closed.The simplest solution, is probably to specify
start = CoroutineStart.ATOMIC
.But for that we need a
start
argument toproduce
.The text was updated successfully, but these errors were encountered: