synchronized

fun DispatchScope<*>.synchronized(block: suspend DispatchScope<*>.() -> Unit): Job

Runs given block as a coroutine in DispatchScope.coroutineScope. Effectively it ensures that any operation on a DispatchScope inside a block runs on proper thread.