mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
13 lines
219 B
Kotlin
13 lines
219 B
Kotlin
|
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!!
|
||
|
}
|