I'm confused by your question a bit. Let me dissec...
# coroutines
e
I'm confused by your question a bit. Let me dissect it.
Task.Delay(timeUnit)
returns a future that is complete after
timeUnit
elapses. This corresponds in Java (and in Kotlin) to this:
Copy code
val executor = Executors.newScheduledThreadPool(1) // create it once for your app
val f = executor.schedule({}, delay, timeUnit) // that is your future
Now if you need to wait, then you take take some library that provides
await
suspending function on futures and do `await(f)`or
f.await()
-- whethever code style you like more (we are moving to the later)