dispatchOnMainThread

inline fun dispatchOnMainThread(crossinline block: () -> Unit)

launch a new coroutine on the main thread if the block is not already called on the main thread. In that case, the code is just executed without the use of a coroutine.