Skip to content

Instantly share code, notes, and snippets.

@madsunrise
Created August 23, 2018 21:14
Show Gist options
  • Select an option

  • Save madsunrise/3b29d7f0084dd0018688fb5f0afd17b3 to your computer and use it in GitHub Desktop.

Select an option

Save madsunrise/3b29d7f0084dd0018688fb5f0afd17b3 to your computer and use it in GitHub Desktop.
fun <T> runSynchronously(asyncFunc: (callback: CallbackWithResult<T>) -> UUID): T {
var result: T? = null
asyncFunc.invoke(CallbackWithResult {
result = it
})
while (true) {
result?.let { return it }
Thread.sleep(250);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment