I have a 3rd party library which has a "normal" sync handler block. I would run some async functions in this handler, but I need to wait for the task:
// 3rd party
func something(block: () -> Int) {
block()
...
}
// my call
func interesting() async -> Int {
...
}
something {
let t = Task {
await interesting()
}
return /* await*/ t.value // how can I wait for this task to return it?
}
How can I archive this?
In Kotlin, you have runBlocking.