runOrPost

fun runOrPost(runnable: Runnable)

If current thread is isMainThread then executes provided runnable otherwise post it.