JavaFXThreadUtil

object JavaFXThreadUtil

Utilties for threading under JavaFX.

Functions

Link copied to clipboard
fun runOnFXThread(task: () -> Unit)

Checks if the current thread is the FX Application thread and calls runLater if so, otherwise runs the task.

Link copied to clipboard
fun <T : Any> syncRunLater(task: () -> T): T

Runs the given task on the FX thread and waits for the task to finish, returning any value the task returns. Throws an exception if the task takes more than a given amount of milliseconds.

Link copied to clipboard
fun <T : Any> syncRunOnFXThread(task: () -> T): T

Checks if the current thread is the FX Application thread and calls syncRunLater if so, otherwise runs the task.