LibreTube/app/src/main/java/com/github/libretube/extensions/AwaitQuery.kt

13 lines
219 B
Kotlin
Raw Normal View History

2022-09-22 21:22:00 +05:30
package com.github.libretube.extensions
fun <T> awaitQuery(
query: () -> T
):T {
var x: T? = null
val thread = Thread {
x = query.invoke()
}
thread.start()
thread.join()
return x!!
}