https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

Sam Garfinkel

08/10/2020, 8:50 PM
Is there a way to extend or modify the
delay
duration of a suspended coroutine from another coroutine?
s

streetsofboston

08/10/2020, 8:52 PM
Not really, unless you poll:
Copy code
while (mustDelayALittleLonger) delay(100)
If you need to synchronize coroutines, try using a `Job`’s
join
or a `Deferred`’s
await
methods….
c

Casey Brooks

08/10/2020, 8:55 PM
There’s a test dispatcher (https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/src/TestCoroutineDispatcher.kt) that allows for fast-forwarding time in unit tests, so I think you’d have to write your own
CoroutineDispatcher
implementation to do something like that
4 Views