package com.github.libretube.extensions fun awaitQuery( query: () -> T ): T { var x: T? = null val thread = Thread { x = query.invoke() } thread.start() thread.join() return x!! }