Here is my code: (updated) ``` while (deferredExpo...
# coroutines
u
Here is my code: (updated)
Copy code
while (deferredExports.any { !it.isCompleted && !it.isCompletedExceptionally }) {
                select<Unit> {
                    deferredExports.forEach {
                        if (!it.isCompleted && !it.isCompletedExceptionally) {
                            it.onAwait {
                            }
                        }
                    }
                }
            }
v
!it.isCompleted && !it.isCompletedExceptionally
is not necessary here in any sense:
await
performs same check and in this code it’s not atomic, so it’s possible to
await
deferred in
Completed
state after checking for
!isCompleted
. Check doesn’t improve neither readability nor performance
u
I know it's broken. But the idea was to not await any deferreds that have already been awaited. I'll check the solution from issue 171 you mentioned below