Andrey Tabakov
07/20/2022, 2:10 PMrunBlocking
Something like this (not working of course)
fun notSuspendedFunction(block: suspend () -> T): String {
val result = await block() // or runBlocking { block() }
return result
}
I'm okay with something like this (not working of course):
fun notSuspendedFunction(block: suspend () -> T): String {
val job = GlobalScope.async { block() }
while(job.isCompleted) { /* may be set timeout or something with delay */ }
return job.getCompleted()
}
Shumaf Lovpache
07/20/2022, 3:17 PM